15. Association In Java


Dynamic Method Dispatch: Previous                                               Next: Inheritance in Java

Association In Java

Association is a way of defining a relationship between classes of objects. Two classes are said to be associate with each other if they are related with each other in some way.

Types of Association:  


types of association in java diagram

Important definitions for association:

Subclass/child class/ derived class:

          A class which is derived from another class.

Super class/ parent class/ Base class: 

           A class from which subclass is derived.

Example:

Let us take the example of Student and MCAStudent. A MCAStudent is derived from Student class and can inherit the properties from Student class. So MCAStudent is a subclass and Student is a super class here.
Note: Every class in java except object class have a super class (object class is a super class of all classes).


Dynamic Method Dispatch: Previous                                               Next: Inheritance In Java