Are Composition and Inheritance the same? If I want to implement the composition pattern, how can I do that in Java?
Composition means creating an object to a class which has relation with that particular class. Suppose Student has relation with Accounts;
An Inheritance is, this is the previous class with the extended feature. That means this new class is the Old class with some extended feature. Suppose Student is Student but All Students are Human. So there is a relationship with student and human. This is Inheritance.