I have a Parent class. I made an array of 3 parent objects. I also have a child class. Is it possible that I can have 1 of those 3 array elements be a child object?
private ParentClass[] a = new ParentClass[3]
ParentClass a[] = {
new ParentClass("0"),
new ParentClass("1"),
new ChildClass("2")
};
This works fine. But I'm wondering, is this the correct way of doing it or is there any easier/cleaner way?
New to java btw from C.
Collection(likeList) instead of arrays 99% of the time though.