-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMultiCatchException.java
More file actions
30 lines (22 loc) · 733 Bytes
/
MultiCatchException.java
File metadata and controls
30 lines (22 loc) · 733 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
package exhand;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
public class MultiCatchException {
public static void main(String[] args) {
try {
int val = 45 / 0; // ERROR: So below lines in try block will be not
// executed.
FileInputStream fi = new FileInputStream("C:\\temp.text");
} catch (ArithmeticException e) {
System.out.println("ArithmeticException");
e.printStackTrace();
} catch (FileNotFoundException e) {
System.out.println("FileNotFoundException");
e.printStackTrace();
} catch (Exception e) {
System.out.println("Exception is called.");
e.printStackTrace();
}
System.out.println("Continue program here!");
}
}