I have class parent A with children B,C,D. Now I have another class E which should have an arraylist containing objects from classes B, C, D.
I thought of class E should extend class A, but I do not know how to add different objects in that arraylist.
Lets have the code like below
Your E class can have instance of list as below
class B,C and E are sub class of A. So this list can hold all the subclass of A
You can assign