Exception Handling in Java Example Program

You can find Exception Handling in Java Examples (Sample) Program) . In this page you can learn basic concept of Exception Handling Example Program.

You can find Exception Handling in Java Examples . In this page you can learn basic concept of Exception Handling Example Program.

class BasicException{
public static void main(String args[]){
int d,a;
try{
d=0;
a=42/d;
System.out.println(“This will not be printed.”);
}
catch(ArithmeticException e){
System.out.println(“Division by zero.”);
}
System.out.println(“After catch statement.”);
}
}
Result:
Division by zero.
After catch statement.

One comment

  • 1
    Mani
    March 13, 2012 - 9:09 am | Permalink

    This Java Exception Handling example program is really simple and easy to understand. Can you also provide that how to handle exception handling in real time scenario. Also tell where to use throw and where should we need to use throws keyword in Java Exception Handing.