Search This Blog

Wednesday, 28 January 2015

Write a programto handle exception using try and catch block



class Ex
{  
public static void main(String args[])
{
 int a=5;
 int b=0;
try
{
int c=a/b;
System.out.println("result="+c);
}
catch(Exception e)
{
System.out.println(e);
}
System.out.println("program terminated");
}
}




                            OUTPUT





No comments:

Post a Comment