TP Exceptions

This commit is contained in:
Simoes Lukas
2025-03-12 17:10:44 +01:00
parent 2a0aa37baa
commit cf33623a5d
45 changed files with 448 additions and 23 deletions

View File

@@ -0,0 +1,16 @@
public class ArithmeticExceptionApplication {
public static int division(int a, int b) {
// En mettant l'exception ici, on option une ligne de plus à l'exécution
return a/b;
}
public static void main(String[] args) {
try {
ArithmeticExceptionApplication.division(7, 0);
} catch (ArithmeticException e) {
System.out.println("Erreur : Division par 0");
}
}
}