-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathqb99.java
More file actions
33 lines (26 loc) · 759 Bytes
/
qb99.java
File metadata and controls
33 lines (26 loc) · 759 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
import java.util.*;
class MyException extends Exception {
MyException(String s) {
super(s);
}
}
class qb99 {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int[] a = new int[5];
for (int i = 0; i < a.length; i++) {
System.out.println("Enter Marks out of 100: ");
a[i] = sc.nextInt();
}
try {
for (int mark : a) {
if (mark < 35) {
throw new MyException("Found: Marks less than 35 !!");
}
}
System.out.println("All Marks Are Valid..");
} catch (MyException e) {
System.out.println("Exception " + e.getMessage());
}
}
}