-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMain_86.java
More file actions
35 lines (35 loc) · 918 Bytes
/
Main_86.java
File metadata and controls
35 lines (35 loc) · 918 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
31
32
33
34
35
import java.util.Scanner;
public class Main_86 {
public static void main(String[] args) {
try{
int a=69/0;
}
catch(IllegalArgumentException e){
System.out.println("haha");
}
catch(ArithmeticException e){
System.out.println("hehe");
}
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;
int i=0;
while(flag && i<5){
try {
System.out.println("Enter index value:");
int ind = in.nextInt();
System.out.println("value at index is " + marks[ind]);
break;
}
catch(Exception e){
System.out.println(e);
}
i++;
}
}
}