-2
public StackException(String message, Throwable cause) {
    super(message, cause);
}

in the above code what StackException does after the method is invoked

2 Answers2

1

What's happening here is that the constructor StackException is just passing the message and cause to its super class. And so, the regarding super class constructor is invoked.

Don't be confused by Exceptions, it is just like any other Java inheritance.

Now, you just need to see what is the the super class of StackException and see what its constructor is doing.

mr.celo
  • 585
  • 1
  • 5
  • 17
Suresh Atta
  • 120,458
  • 37
  • 198
  • 307
0

Here super class constructor is invoked through stack exception. Don't relate here throw able with errors and exception.