What is composition in Java?

The composition is a design technique in java to implement a has-a relationship . Java Inheritance is used for code reuse purposes and the same we can do by using composition. The composition is achieved by using an instance variable that refers to other objects.

Read more