Saturday, May 30, 2015

Exception Handling


public class Class1 {

public static void main(String[] args) {

try {
System.out.println("TRY BLOCK");
int i = 1/0;
} catch (ArithmeticException e) {
System.out.println(e);
//e.printStackTrace();
System.out.println(" You gotta problems honey");
}catch (Exception e) {
e.printStackTrace();
}finally{
System.out.println("Finally block always executes");
}
}
}


No comments:

Post a Comment