SOFTWARE DESIGN
OBJECT ORIENTED DESIGN
Question
[CLICK ON ANY CHOICE TO KNOW THE RIGHT ANSWER]
|
Good reasons to group classes into the same package are that classes:
|
Relating to each other by specialization
|
|
They are related to each other by aggregation.
|
|
Semantically related and prone to change together
|
|
Built by the same team of developers
|
Explanation:
Detailed explanation-1: -A package in Java is used to group related classes. Think of it as a folder in a file directory. We use packages to avoid name conflicts, and to write a better maintainable code.
Detailed explanation-2: -You can create instances of a class as distinct, individual objects that behave as specified. A package is simply a namespace under which you can categorize classes, analogous to a “folder” or “path", so you can group classes with related purpose or functionality.
Detailed explanation-3: -Java package is used to categorize the classes and interfaces so that they can be easily maintained. Java package provides access protection. Java package removes naming collision.
There is 1 question to complete.