Professional Documents
Culture Documents
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 {
try
System.out.print("A");
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");