- Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathNestedCatch.java
More file actions
Latest commit
30 lines (25 loc) · 655 Bytes
/
Copy pathNestedCatch.java
File metadata and controls
30 lines (25 loc) · 655 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
publicclassNestedCatch
{
publicstaticvoidmain(String[] args)
{
intA[]={30,20,10,40,0};
try
{
intc=A[0]/A[4];
System.out.println("Division is "+c);
try
{
System.out.println(A[5]);
}
catch(ArrayIndexOutOfBoundsExceptione)
{
System.out.println("Index is Invalid");
}
}
catch(ArithmeticExceptione)
{
System.out.println("Denominator should not be 0");
}
System.out.println("Bye");
}
}