Java - Custom Exceptions
What will be the output of this code?
class MyException extends Exception {}
public class Test {
public static void main(String[] args) {
try {
throw new MyException();
} catch (MyException e) {
System.out.println("Caught MyException");
} catch (Exception e) {
System.out.println("Caught Exception");
}
}
}