Source of Question30.java


  1: //Question30.java
  2: 
  3: public class Question30
  4: {
  5:     public static void main(String[] args)
  6:     {
  7:         Question30 object = new Question30();
  8:         try
  9:         {
 10:             System.out.println("Trying");
 11:             object.sampleMethod();
 12:             System.out.println("Trying after call.");
 13:         }
 14:         catch (Exception e)
 15:         {
 16:             System.out.println("Catching");
 17:             System.out.println(e.getMessage());
 18:         }
 19:     }
 20:     public void sampleMethod() throws Exception
 21:     {
 22:         System.out.println("Starting sampleMethod.");
 23:         throw new Exception("From sampleMethod with love.");
 24:     }
 25: }