Java - Custom Exceptions
Which of the following is the correct constructor for a custom exception class named
MyException?MyException?super(message) to pass the message to the parent Exception class.super(message). public MyException() { this.message = message; } incorrectly assigns message without declaration. public void MyException(String message) { super(message); } has a void return type, so it's not a constructor. public MyException(String message) { print(message); } calls a non-existent method print.15+ quiz questions · All difficulty levels · Free
Free Signup - Practice All Questions