Which is a key aspect of composition?
A.
Using inheritance
B.
Method delegation
C.
Creating abstract classes
D.
Implementing the composite interface
Explanation:
In an object-oriented design of a Java program, the way in which you model objects that contain other objects is with composition, the act of composing a class out of references to other objects. With composition, references to the constituent objects become fields of the containing object.
To use composition in Java, you use instance variables of one object to hold references to other objects.The relationship modeled by composition is often referred to as the “has-a” relationship.
Delegation involves re-exporting methods; in a composition relationship, the inner objects methods may be used only privately and not re-exposed.