Files
DEV/DEV.2.1/TP/TP10-Exceptions/2./Capture.java

16 lines
284 B
Java
Raw Normal View History

2025-09-30 09:43:41 +02:00
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");
}
}
}