Question: Consider the following scenario: You are designing a complex object-oriented system in Java, and you want to ensure that your classes are designed in a

Consider the following scenario:

You are designing a complex object-oriented system in Java, and you want to ensure that your classes are designed in a way that maximizes encapsulation and minimizes coupling.
Which of the following statements is true about Java classes?


A) A class should have only a single responsibility and should not be responsible for multiple tasks or functions.

B) A class should expose its internal state as public members to promote ease of use and flexibility.

C) A class should directly manipulate the state of other classes to minimize dependencies and increase modularity.

D) A class should expose its private methods and properties to subclasses to promote code reuse.


Note: You can assume that the system you are designing is complex and includes multiple classes that interact with each other.

Step by Step Solution

3.34 Rating (160 Votes )

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock

The detailed answer for the above question is provided below The correct answer is A A class should ... View full answer

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 Programming Questions!