We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent f58f0b5 commit bc838e7Copy full SHA for bc838e7
ExceptionOwn.java
@@ -0,0 +1,35 @@
1
+import java.util.*;
2
+
3
+class MyExp extends Exception
4
+{
5
+ MyExp(String msg)
6
+ {
7
+ super(msg);
8
+ }
9
+}
10
+class ExceptionOwn
11
12
+ public static void main(String args[])
13
14
+ Scanner sc = new Scanner(System.in);
15
+ System.out.print("Input Percentage :- ");
16
+ int per = sc.nextInt();
17
18
+ try
19
20
+ if(per < 40)
21
22
+ throw new MyExp("YOU ARE FAILED, LOSER!!");
23
24
+ else
25
26
+ System.out.println("YOU ARE PASSED, GOOD JOB!");
27
28
+ System.out.println("You Obtained " + per + "percent");
29
30
+ catch(MyExp e)
31
32
+ System.out.println(e.getMessage());
33
34
35
0 commit comments