public class Question21
1: //Question21.java
2:
3: import java.util.Scanner;
4:
5: public class Question21
6: {
7: public static void main(String[] args)
8: {
9: try
10: {
11: System.out.println("try block entered:");
12: int number = -99;
13: if (number > 0)
14: throw new DoubleException("DoubleException thrown!");
15: System.out.println("Leaving try block.");
16: }
17: catch (DoubleException exceptionObject)
18: {
19: System.out.println(exceptionObject.getMessage());
20: }
21: System.out.println("End of code.");
22: }
23: }