public class Main {
public static void main(String[] args) {
try {
throw new CustomException("Alarm!");
} catch (CustomException e) {
System.out.println(e);
}
throw new MyException("");
}
}
public class CustomException extends Exception {
public CustomException(String message) {
super(message);
}
}
public class MyException extends RuntimeException {
public MyException(String message) {
super(message);
}
}
Comments
Leave a comment