Matura: Softwareentwicklung & Informationssysteme

3.4. Exceptions

Verschachteln

Throwen von Exceptions

throw new EmptyStackException();
void testMethod() throws ArithmeticException

CustomExceptions

public class HandledException extends Exception {
    private String code;

    public HandledException(String code, String message) {
        super(message);
        this.setCode(code);
    }

    public HandledException(String code, String message, Throwable cause) {
        super(message, cause);
        this.setCode(code);
    }

    public String getCode() {
        return code;
    }

    public void setCode(String code) {
        this.code = code;
    }
}

Wo sollen sie behandelt werden?