In the following scenario
public class Parent1 { } public class Child1 extends Parent1 {} Child1 c1 = new Child1(); Child1 c2 = new Child1();
objects c1,c2 also creates two objects of Parent1 class?
and can you guys please tell me how can i check in real time ?
Thanks in advance
When you create child objects, memory will be allocated for the members of parent object as well. You can check that parent object is being created by having a System.out.println in the parent class’s constructor.