II B.Tech II Sem CSE Java Lab Exercise - 7a (Exception)
a) Exception handling mechanism
Aim: To write a JAVA program that describes exception handling mechanism
Description:
Program:
Usage of Exception Handling:
class trydemo
{
public static void main(String args[])
{
try
{
int a=10,b=0;
int c=a/b;
System.out.println(c);
}
catch(ArithmeticException e)
{
System.out.println(e);
}
System.out.println("After the catch statement");
}
}
Output:
No comments