Java – Composition – MCQ
Composition is a stronger form of aggregation, where the contained object cannot exist without the container, implying ownership and a lifecycle dependency.
Selvam College of Technology (Autonomous)
Composition is a stronger form of aggregation, where the contained object cannot exist without the container, implying ownership and a lifecycle dependency.
Aggregation is a special form of association where one object “has-a” relationship with another, but the contained object can exist independently.
In Java, association refers to a general relationship between two objects, where one object uses or interacts with another, without owning it.
In Java, the ListIterator interface is used to iterate over elements in a List collection, such as an ArrayList. Unlike the regular Iterator, a ListIterator
In Java, the ListIterator interface is used to iterate over elements in a List collection, such as an ArrayList. Unlike the regular Iterator, a ListIterator
Enum is a special data type that defines a set of constants, providing type safety and allowing for more readable code, especially when dealing with
In Java, access modifiers define the visibility of classes, methods, and variables. They include public, protected, private, and the default (package-private) modifier.
Scope in Java refers to the region of the program where a variable, method, or class is accessible. It determines the visibility and lifetime of
In Java, packages are used to group related classes and interfaces, providing a modular structure to organize code and avoid naming conflicts. A package can
In Java, the final keyword is used to define constants, prevent method overriding, and prevent inheritance. When applied to a variable, it makes the value