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
Step: 1
The detailed answer for the above question is provided below The correct answer is A A class should ...Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started