How aren't these exceptions unique?
package com.codegym.task.task14.task1419;
import java.util.ArrayList;
import java.util.List;
/*
Exception 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() { // The first exception
try {
float i = 1 / 0;
} catch (Exception e) {
exceptions.add(e);
}
//write your code here
exceptions.add(new NoSuchFieldException());
exceptions.add(new IndexOutOfBoundsException());
exceptions.add(new RuntimeException());
exceptions.add(new SecurityException());
exceptions.add(new NoSuchFieldException());
exceptions.add(new ArithmeticException());
exceptions.add(new NumberFormatException());
exceptions.add(new NegativeArraySizeException());
exceptions.add(new UnsupportedOperationException());
}
}