Question: 3.1. Answer these questions: a. Explain how encapsulation is used for the implementation of the Day class from the textbook and what is achieved by

3.1. Answer these questions:

a. Explain how encapsulation is used for the implementation of the Day class from the textbook and what is achieved by using that principle (i.e. advantages versus not using it).

b. What is the role of a contract when we write a method ?

c. What are the advantages of making a class immutable ? Discuss in principle, then in the context of the String Java class.

d. What is the argument of the Law of Demeter ? Explain why we should (try to) follow it.

e. Explain why a lack of consistency in class design is detrimental.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!