-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMain_82.java
More file actions
30 lines (30 loc) · 944 Bytes
/
Main_82.java
File metadata and controls
30 lines (30 loc) · 944 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
import java.util.Scanner;
public class Main_82 {
public static void main(String[] args) {
int marks[]=new int[5];
marks[0]=45;
marks[1]=54;
marks[2]=67;
marks[3]=49;
marks[4]=23;
Scanner in=new Scanner(System.in);
boolean flag=true;
while(flag) {
System.out.println("Enter array index:");
int ind = in.nextInt();
try {
System.out.println("Hello, let us learn");
try {
System.out.println(marks[ind]);
} catch (ArrayIndexOutOfBoundsException e) {
System.out.println("Index not exists");
System.out.println("Exception in level 2");
}
}
catch (Exception e) {
System.out.println("Exception in level 1");
}
}
System.out.println("Ends");
}
}