yes you are correct , that my mistake Thanks for pointing out
In Java, if a child class doesn't explicitly define its own constructor, it automatically inherits the default no-argument constructor from the parent class. However, if the parent class defines parameterized constructors, the child class doesn't automatically inherit them. You can manually call a parent constructor using the super() keyword within the child class's constructor.
Even in that case, it doesn't inherit the default no-parameter constructor. In Java, constructors are never inherited. There are 2 things going on in that case. If a class doesn't explicitly define a constructor, the Java compiler generates a default constructor for you that simply calls super(). The second thing is that if you do define a constructor but don't explicitly call a superclass constructor, the Java compiler inserts a call to super() in the bytecode that it generates.
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
yes you are correct , that my mistake Thanks for pointing out
In Java, if a child class doesn't explicitly define its own constructor, it automatically inherits the default no-argument constructor from the parent class. However, if the parent class defines parameterized constructors, the child class doesn't automatically inherit them. You can manually call a parent constructor using the super() keyword within the child class's constructor.
Even in that case, it doesn't inherit the default no-parameter constructor. In Java, constructors are never inherited. There are 2 things going on in that case. If a class doesn't explicitly define a constructor, the Java compiler generates a default constructor for you that simply calls
super(). The second thing is that if you do define a constructor but don't explicitly call a superclass constructor, the Java compiler inserts a call tosuper()in the bytecode that it generates.