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:


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.


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).

Next Topic: Inheritance in java with examples.
Previous Topic: Dynamic method dispatch or Runtime polymorphism in java with example.


Please Share