Exception Handling in Java Example Program

By | December 22, 2010
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 thought on “Exception Handling in Java Example Program

  1. Mani

    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.

    Reply

Leave a Reply

Your email address will not be published. Required fields are marked *