public class MainClass
{
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("Zero cannot divide any no.");// we can give any message
}
System.out.println("After catch statement.");
}
}
Saturday, May 29, 2010
program of try and catch..
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment