Что не так , Задание ведь выполнено.
package com.javarush.task.task14.task1419;
import java.io.*;
import java.util.ArrayList;
import java.util.List;
/*
Нашествие исключений
*/
public class Solution {
public static List<Exception> exceptions = new ArrayList<Exception>();
public static void df(short x) {
x++;
}
public static void main(String[] args) {
initExceptions();
for (Exception exception : exceptions) {
System.out.println(exception);
}
}
private static <fd> void initExceptions() { //the first exception
try {
float i = 1 / 0;
} catch (ArithmeticException e) {
exceptions.add(e);
}
try {
int[] d = {2, 3, 4};
System.out.println(d[3]);
} catch (ArrayIndexOutOfBoundsException e) {
exceptions.add(e);
}
try {
Object f[] = new String[5];
f[0] = new Character('*');
} catch (ArrayStoreException e) {
exceptions.add(e);
}
try {
Object ch = new Character('*');
System.out.println((Byte) ch);
} catch (ClassCastException e) {
exceptions.add(e);
System.out.println("ClassCastException - " + e);
}
try {
int[] f = new int[-2];
} catch (NegativeArraySizeException e) {
exceptions.add(e);
}
try {
int[] f = new int[2];
f = null;
int r = f.length;
} catch (NullPointerException e) {
exceptions.add(e);
}
try {
String szShortString = "123";
char chr = szShortString.charAt(10);
} catch (StringIndexOutOfBoundsException e) {
exceptions.add(e);
}
try {
InputStream f = new FileInputStream("sdff");
} catch (FileNotFoundException e) {
exceptions.add(e);
}
try {
FileWriter fileWriter = null;
fileWriter = new FileWriter("out.txt");
fileWriter.close();
fileWriter.write(5);
} catch (IOException e) {
exceptions.add(e);
}
try {
Class.forName("");
} catch (ClassNotFoundException e) {
exceptions.add(e);
}
//напишите тут ваш код
}
}