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.

Sizin İçin Seçtik  How do you create a Java project?

Leave a Reply

Your email address will not be published. Required fields are marked *