Source of Question21.java


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