I am greatly confused with Overriding Constructors. Constructor can not be overridden is the result what i get when i searched it in google my question is
p
You cannot override the constructor as the constructor is invoked by the name of the class it constructs. How can you create some different class with the same constructor? Also, a child class does not inherit constructors from its parent.
If the parent constructor does some important initialization, it can be called from the child constructor using super:
class Err extends Throwable {
Err(String message) {
super(message); // Call the constructor of Throwable.
..
The parent class constructor is also always called. If you yourself do not call any, a constructor without parameters is called automatically before entering a constructor of the derived class. If the parent has no parameterless constructor and you do not call any, a compile time error is reported.