Complete the code to declare a custom exception class named MyException.
public class MyException extends [1] { }
The custom exception class should extend the built-in Exception class to be a checked exception.
Complete the constructor to pass the error message to the superclass.
public class MyException extends Exception { public MyException([1] message) { super(message); } }
The constructor takes a String message and passes it to the superclass constructor.
Fix the error in the constructor to correctly call the superclass constructor.
public class MyException extends Exception { public MyException(String message) { [1](message); } }
The constructor must call super(message) to pass the message to the parent Exception class.
Fill both blanks to add a no-argument constructor that calls the superclass constructor with a default message.
public class MyException extends Exception { public MyException() { [1]("[2] error occurred"); } }
The no-argument constructor calls super with a default message string.
Fill all three blanks to add a constructor that accepts a message and a cause, passing both to the superclass.
public class MyException extends Exception { public MyException([1] message, [2] cause) { [3](message, cause); } }
The constructor takes a String message and a Throwable cause, then calls super(message, cause).