Super call in custom exception

constructor, exception, java

Solution

Since a derived class always has the base class as a template, it is necessary to initialize the base class as the first step in constructing the derived object. By default, if no `super` call is made, Java will use a default (parameterless) constructor to create the base class. If you want a different constructor to be used, you have to use `super` to pass in the parameters you want and invoke the correct constructor.

In the case of custom exceptions, it is common to use `super` to initialize the exception's error message; by passing the message into the base class constructor, the base class will take care of the work of setting the message up correctly.

Problem

I just want to know why we call super in own created custom exception. ``` public class MyException extends Exception { public MyException(String message) { super(message); } } ``` Here What is the use of calling super(message)

Original source