0

If only one then how Parent class constructor gets executed when sub class object is create

class Parent
{
 Parent()
 {
  System.out.println("Parent class construcor");
 }
}
class Child extends Parent 
{
 Child()
 {
  System.out.println("Child class construcor");
 }
 
}
 class Test
 {
  public static void main(String a[])
  {
   Child obj = new Child();
  }
 }

0 Answers0