Source of Question19.java


  1: //Question19.java
  2: 
  3: import java.util.Scanner;
  4: 
  5: public class Question19
  6: {
  7:     public static void main(String[] args)
  8:     {
  9:         try
 10:         {
 11:             System.out.println("try block entered:");
 12:             int number = 42;
 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: }