What is composition in OOP in Java?

Composition is one of the fundamental concepts in object-oriented programming. It describes a class that references one or more objects of other classes in instance variables . This allows you to model a has-a association between objects. You can find such relationships quite regularly in the real world.

Read more