0% found this document useful (0 votes)
26 views1 page

FJP Exp 9

Code

Uploaded by

badhednyandeep04
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
26 views1 page

FJP Exp 9

Code

Uploaded by

badhednyandeep04
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 1

Name : Dnyandeep Badhe

Batch : D2
Roll No. :
304D034
Experiment No. 9
Code :

package company;
public class Exception
{
public static void main(String[] args) {
int a = 4;
int b = 5;
int arr[] = {1,2,3,4,5};

try {
int c = a/b;
System.out.println("c = "+c);
arr[6]= 10;
}catch(ArithmeticException e) {
System.out.println("Arithmatic Exception :");
e.printStackTrace();
}catch(ArrayIndexOutOfBoundsException f) {
System.out.println("Array Index Out of Bounds Exception
:");
f.printStackTrace();
}finally {
System.out.println("Finally Block Executed :");
}
}
}

Output :
c =
0
Array Index Out of Bounds Exception :
java.lang.ArrayIndexOutOfBoundsException: Index 6 out of bounds for
length 5
at company.Exception.main(Exception.java:14) Finally
Block Executed :

You might also like