update
This commit is contained in:
15
DEV.2.1/TP/TP10-Exceptions/2./Capture.java
Normal file
15
DEV.2.1/TP/TP10-Exceptions/2./Capture.java
Normal file
@@ -0,0 +1,15 @@
|
||||
public class Capture {
|
||||
|
||||
public static int ArithmeticPB(int val) {
|
||||
return val/0;
|
||||
}
|
||||
|
||||
public static void main(String[] args) {
|
||||
try {
|
||||
int res = ArithmeticPB(5);
|
||||
System.out.println(res);
|
||||
} catch(ArithmeticException e) {
|
||||
System.err.println("cannot divide by 0");
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user