It is the design technique for implementing has-a relationship in a class. You can use java inheritance or Object composition for reusing the code. You can achieve Java composition by using instance variables that are referring to other objects.

BY Best Interview Question ON 13 Jan 2019