-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathException.java
44 lines (37 loc) · 1.15 KB
/
Exception.java
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 org.moro.pages;
import java.io.IOException;
/**
* Created by eyal on 07/12/2016.
*/
public class Exception {
public static void main(String[] args) {
try {
int a=5, b=0;
double d = a/b;
System.out.println("ssssss");
}
catch (ArithmeticException e){
System.out.println("shalom");
}
catch (NumberFormatException e){
System.out.println("bye");
}
//if both of the catch doesn't contain the exception then it will throw a new one!
catch (java.lang.Exception e){
System.out.println("unknown issue"); //catch every exception
throw e;//will throw the exception again...
}
finally {
//will always happened if defined even if no exception occurred
// try {
// Thread.sleep(1000);
// } catch(InterruptedException ex) {
// Thread.currentThread().interrupt();
// }
}
}
public void f() throws IOException {
// createNewFile();
}
// Thread.sleep(1000);
}