1: public class Question28
2: {
3: public static void main(String[] args)
4: {
5: try
6: {
7: int n = -7;
8: if (n > 0)
9: throw new Exception( );
10: else if (n < 0)
11: throw new NegativeNumberException( );
12: else
13: System.out.println("Hello!");
14: }
15: catch(NegativeNumberException e)
16: {
17: System.out.println("First catch.");
18: }
19: catch(Exception e)
20: {
21: System.out.println("Second catch");
22: }
23: System.out.println("End of code");
24: }
25: }