Discovering custom exceptions in Java

Report a typo

Consider the following Java class definitions.

public class CustomException extends Exception {

    public CustomException(String message) {
        super(message);
    }

    public CustomException(String message, Throwable cause) {
        super(message, cause);
    }

}
public class Main {

    public static void main(String[] args) {
        try {
            throw new CustomException("This is a custom exception!");
        } catch (CustomException e) {
            e.printStackTrace();
        }
    }

}

What statements are true about custom exceptions in Java?

Select one or more options from the list
___

Create a free account to access the full topic