Source of Question30.java


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