Вроде, названия отличаются
package com.javarush.task.task14.task1419;
import java.io.*;
import java.nio.Buffer;
import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;
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);
}
}
public static void func(byte vv){
System.out.println(vv);
}
private static void initExceptions() { //the first exception
try {
float i = 1 / 0;
} catch (Exception e) {
exceptions.add(e);
}
try {
int i = 1 / 0;
} catch (ArithmeticException e) {
exceptions.add(e);
}
try {
int[] arr = new int[2];
arr[arr.length] = 2;
} catch (ArrayIndexOutOfBoundsException e) {
exceptions.add(e);
}
try {
BufferedReader bfr = new BufferedReader(new InputStreamReader(System.in));
int i = Integer.parseInt(bfr.readLine());
} catch (IOException e) {
exceptions.add(e);
}
try {
func((byte) 10);
} catch (NumberFormatException e) {
exceptions.add(e);
}
try {
FileInputStream fileInputStream = new FileInputStream("c:\\ddd");
} catch (FileNotFoundException e) {
exceptions.add(e);
}
try {
func((byte) 5);
} catch (IllegalArgumentException e) {
exceptions.add(e);
}
try {
int[] arr = new int[2];
System.out.println(arr[2]);
} catch (IndexOutOfBoundsException e) {
exceptions.add(e);
}
try {
String s = null;
System.out.println(" " + s);
} catch (NullPointerException e) {
exceptions.add(e);
}
try {
String s = new String();
Object obj = (Object) s;
} catch (ClassCastException e) {
exceptions.add(e);
}
}
}