Free Data Structures and Algorithms Course









Subscribe below and get all best seller courses for free !!!










OR



Subscribe to all free courses

Working example of Constructor behavior in Java Inheritance

Program to demonstrate working example of Constructor behavior in Java Inheritance

package com.hubberspot.code;

class Drawing {
 
   public Drawing(){
 System.out.println("Drawing Constructor called");
   }  
}

class Shape extends Drawing{
 
   public Shape(){
 System.out.println("Shape Constructor called");
   } 
}

public class Circle extends Shape{
 
   public Circle(){
 System.out.println("Circle Constructor called");
   }
 
   public static void main(String[] args) {
  
 Circle circle = new Circle();
 
   }

}


Output of the program :



 
© 2021 Learn Java by Examples Template by Hubberspot