Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class Ex1 extends Exception {}
- class Ex2 extends Ex1 {}
- class Q2 {
- public static void main(String args[]) {
- // some other stuff
- try {
- // Some monitored code
- throw new Ex2();
- }
- catch(Ex1 e) {
- System.out.println("Caught Ex1 exception");
- }
- catch(Ex2 e) {
- System.out.println("Caught Ex2 exception");
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement