This commit is contained in:
2024-03-18 14:28:35 +01:00
parent a28bef01d7
commit cd3133cbe1
8 changed files with 90 additions and 37 deletions

View File

@@ -0,0 +1,6 @@
public class NullPointerException {
public static void main(String[] args) {
String str = null;
int length = str.length(); // Tentative d'accéder à une méthode sur un objet nul
}
}

View File

@@ -0,0 +1,6 @@
public class NumberFormatException {
public static void main(String[] args) {
String str = "abc";
int num = Integer.parseInt(str); // Conversion d'une chaîne non numérique en entier
}
}

View File

@@ -0,0 +1,5 @@
public class RuntimeExceptionExample {
public static void main(String[] args) {
throw new UnsupportedOperationException("Operation not supported"); // Lancement d'une exception d'opération non supportée
}
}