The child constructor always calls one of the parent constructors*; if you leave out the call to "super(...)" one will be added implicitly without any arguments. This whole process of a child class constructor calling its super class constructor is called constructor chaining, and it will only end when Object's non-argument constructor is called.
In this case, the parent constructor can throw an exception so the child constructor must, as always, either catch it or declare throw it. Since the first statement must always be a call to "super(...)" or "this(...)" (as said before, if you don't add it the compiler will) catching is not allowed so the only option is to throw it.
* Or another constructor of the same class if the first call is to "this(...)".
Consider this example:
Even though class TS has a constructor that takes a String, and you can call new T("Hello World"), class Child does not so calling new Child("Hello World") will not work.
Now i am understanding why do we need to override different constructors that are present inside the Exception class when extending the Exception class .
Ravi Kiran V wrote:
Now i am understanding why do we need to override different constructors that are present inside the Exception class when extending the Exception class .
Thanks once again .
Look at the constructors. Why do you think they have to be overridden?