Why Constructors are not inherited in Java? Last Updated : 30 Nov, 2018 Comments Improve Suggest changes Like Article Like Report Constructor is a block of code that allows you to create an object of class and has same name as class with no explicit return type. Whenever a class (child class) extends another class (parent class), the sub class inherits state and behavior in the form of variables and methods from its super class but it does not inherit constructor of super class because of following reasons: Constructors are special and have same name as class name. So if constructors were inherited in child class then child class would contain a parent class constructor which is against the constraint that constructor should have same name as class name. For example see the below code: Java class Parent { public Parent() { } public void print() { } } public class Child extends Parent { public Parent() { } public void print() { } public static void main(String[] args) { Child c1 = new Child(); // allowed Child c2 = new Parent(); // not allowed } } If we define Parent class constructor inside Child class it will give compile time error for return type and consider it a method. But for print method it does not give any compile time error and consider it a overriding method. Now suppose if constructors can be inherited then it will be impossible to achieving encapsulation. Because by using a super class's constructor we can access/initialize private members of a class. A constructor cannot be called as a method. It is called when object of the class is created so it does not make sense of creating child class object using parent class constructor notation. i.e. Child c = new Parent(); A parent class constructor is not inherited in child class and this is why super() is added automatically in child class constructor if there is no explicit call to super or this. Comment More infoAdvertise with us Next Article Constructor Overloading in Java S Sajid Ali Khan Improve Article Tags : Java java-inheritance Java-Constructors java-overriding Practice Tags : Java Similar Reads Java Constructors In Java, constructors play an important role in object creation. A constructor is a special block of code that is called when an object is created. Its main job is to initialize the object, to set up its internal state, or to assign default values to its attributes. This process happens automaticall 10 min read Default constructor in Java Like C++, Java automatically creates default constructor if there is no default or parameterized constructor written by user, and (like C++) the default constructor automatically calls parent default constructor. But unlike C++, default constructor in Java initializes member data variable to default 1 min read Private Constructors and Singleton Classes in Java In Java, the private constructor is a special type of constructor that cannot be accessed from outside the class. This is used in conjunction with the singleton design pattern to control the instantiation. Private ConstructorThe private constructor is used to resist other classes to create new insta 2 min read Copy Constructor in Java Like C++, Java also supports a copy constructor. But, unlike C++, Java doesn't create a default copy constructor if you don't write your own. A prerequisite prior to learning copy constructors is to learn about constructors in java to deeper roots. Below is an example Java program that shows a simpl 4 min read Constructor Chaining In Java with Examples Constructor chaining is the process of calling one constructor from another constructor with respect to current object. One of the main use of constructor chaining is to avoid duplicate codes while having multiple constructor (by means of constructor overloading) and make code more readable. Prerequ 5 min read Why Constructors are not inherited in Java? Constructor is a block of code that allows you to create an object of class and has same name as class with no explicit return type. Whenever a class (child class) extends another class (parent class), the sub class inherits state and behavior in the form of variables and methods from its super clas 2 min read Constructor Overloading in Java Java supports Constructor Overloading in addition to overloading methods. In Java, overloaded constructor is called based on the parameters specified when a new is executed. When do we need Constructor Overloading? Sometimes there is a need of initializing an object in different ways. This can be do 5 min read Static Blocks in Java In simpler language whenever we use a static keyword and associate it to a block then that block is referred to as a static block. Unlike C++, Java supports a special block, called a static block (also called static clause) that can be used for static initialization of a class. This code inside the 4 min read The Initializer Block in Java In order to perform any operations while assigning values to an instance data member, an initializer block is used. In simpler terms, the initializer block is used to declare/initialize the common part of various constructors of a class. It runs every time whenever the object is created. The initial 2 min read Order of Execution of Initialization Blocks and Constructors in Java In Java, there are various techniques, which we can use to initialize and perform operations on objects such as methods, constructors, and initialization blocks. These tools are used to ensure that the program works as expected. Instance Initialization Blocks (IIB) are used to initialize instance va 4 min read Like