Search This Blog

27 June, 2011

Why in java - Need of Exception Handling


class ppp
{
public static void main(String ff[])
{
int a, b, c;
a = 10;
b= 0;
c=a/b;
/*Code termination because Arithmetic Exception of divide by zero*/

System.out.println(c);

//Some lines of code

System.out.println("program exits");
}  // Neat End
}


Output:- Exception in thread "main" java.lang.ArithmeticException: / by Zero. 

Note:- Thus to provide successful or Neat End to this program. We need to handle Exception or can say need of Exception handling topic and to do it we have to understand why exception is generation in code.

------------- Continue ->  Exception Handling -------------------------

No comments:

Post a Comment

Meetme@