forked from deepdalsania/tutorials
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCustom_Ex2.java
More file actions
44 lines (37 loc) · 867 Bytes
/
Custom_Ex2.java
File metadata and controls
44 lines (37 loc) · 867 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
36
37
38
39
40
41
42
43
44
package exception;
import java.util.Scanner;
public class Custom_Ex2 {
/**
* @param args
*/
public static void main(String[] args) {
// TODO Auto-generated method stub
Scanner s = new Scanner(System.in);
System.out.println("Enter the value of A and B : ");
int a = s.nextInt();
int b = s.nextInt();
int c = a + b;
float t = (float) c / 50000000000.1f;
call(t);
s.close();
}
static void call(float t) {
if (t < 0.000001f) {
try {
throw new NumberIsNegligibleException("Number is Negligible.");
}
catch (NumberIsNegligibleException e) {
System.out.println(e);
}
} else {
System.out.println("Number isnot Negligible.");
}
}
}
@SuppressWarnings("serial")
class NumberIsNegligibleException extends Exception {
NumberIsNegligibleException(String s) {
// TODO Auto-generated constructor stub
super(s);
}
}