II B.Tech II Sem CSE Java Lab Exercise - 7b (Exception)

b) Illustrating multiple catch classes

Aim:To write a JAVA program Illustrating Multiple catch clauses

Description:


Program:

class multitrydemo 
{
public static void main(String args[]) 
{
try 
{
int a=10,b=5; 
int c=a/b;
int d[]={0,1}; 
System.out.println(d[10]); 
System.out.println(c);
}
catch(ArithmeticException e) 
{
System.out.println(e); 
}
catch(ArrayIndexOutOfBoundsException e) 
{
System.out.println(e); 
}
System.out.println("After the catch statement");
}
}

Output:


No comments

Web Development with PHP Course

  Course : Web Development with PHP The Importance Of PHP Web Development Website development is rapidly growing tool for business developme...