What the problem here, I don´t see any exceptions twice in the list..
package com.codegym.task.task14.task1419;
import java.util.ArrayList;
import java.util.List;
import java.io.*;
import java.security.GeneralSecurityException;
import java.security.KeyException;
import java.security.DigestException;
import java.security.SignatureException;
/*
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 InterruptedException());
exceptions.add(new ClassNotFoundException());
exceptions.add(new RuntimeException());
exceptions.add(new ArithmeticException());
exceptions.add(new ArrayStoreException());
exceptions.add(new ClassCastException());
exceptions.add(new IllegalArgumentException());
exceptions.add(new IndexOutOfBoundsException());
exceptions.add(new NegativeArraySizeException());
}
}