Was ist eine "eindeutige" Exception/Ausnahme?
(Finde die Erklärung irgendwie nicht.)
package de.codegym.task.task14.task1419;
import java.util.ArrayList;
import java.util.List;
import java.io.*;
/*
Ausnahme-Invasion
*/
public class Solution {
public static List<Exception> exceptions = new ArrayList<Exception>();
public static void main(String[] args) {
initExceptions();
for (Exception exception : exceptions) {
System.out.println(exception);
}
}
private static void initExceptions() { // Die erste Ausnahme
try {
float i = 1 / 0;
} catch (Exception e) {
exceptions.add(e);
}
exceptions.add(new IndexOutOfBoundsException());
exceptions.add(new ArrayIndexOutOfBoundsException());
exceptions.add(new IllegalStateException());
exceptions.add(new ClassCastException());
exceptions.add(new NoSuchFieldException());
exceptions.add(new NullPointerException());
exceptions.add(new SecurityException());
exceptions.add(new NumberFormatException());
exceptions.add(new ArithmeticException());
//schreib hier deinen Code
}
}