forked from deepdalsania/tutorials
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathChained_Try.java
More file actions
40 lines (33 loc) · 861 Bytes
/
Chained_Try.java
File metadata and controls
40 lines (33 loc) · 861 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
package exception;
import java.util.Scanner;
public class Chained_Try {
/**
* @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 for division = ");
int a = s.nextInt();
int b = s.nextInt();
s.close();
// Integer i = new Integer("1");
String s1 = new String("DEEP");
try {
System.out.println("Inside try block");
int c = a / b;
System.out.println("Division is : " + c);
try {
System.out.println("Inside try block of try block ");
int d = Integer.parseInt(s1);
System.out.println(d);
// System.out.println(i);
} catch (NumberFormatException e) {
System.out.println(e);
}
} catch (ArithmeticException e) {
// TODO: handle exception
System.out.println(e);
}
}
}