Monday, October 12, 2009

Java Try catch block


 /**
 *
 */
package com.myapp.testpackage;


/**
 * @author sunil.chand
 *
 */
public class Exc1 {
  public static void main(String args[]){
      int d,a;
      try{
          d=0;
          a=42/d;
          System.out.println("never printed");
      }
      catch (ArithmeticException e){
          System.out.println("Division by zero not possible"); 
      }
            
  }
}

No comments: