You are on page 1of 2

public 

class JavaExceptionExample{  
  public static void main(String args[]){  
   try
{  
      //code that may raise exception  
      int data=100/0;  
   }
catch(ArithmeticException e)
{System.out.println(e);}  
   //rest code of the program   
   System.out.println("rest of the code...");  
  }  

public class JavaHungry {

public static void main(String args[])

try

System.out.print("A");

int num = 99/0;

System.out.print("B");

catch(ArithmeticException ex)

System.out.print("C");

catch(Exception ex)

System.out.print("D");

finally

System.out.print("E");

System.out.print("F");

You might also like