Что не так?
Исключение системы безопасности JavaRush. Вы выполняете потенциально опасную или запрещенную операцию.
package com.javarush.task.task14.task1419;
import java.io.*;
import java.net.MalformedURLException;
import java.net.URISyntaxException;
import java.net.URL;
import java.net.UnknownHostException;
import java.sql.Connection;
import java.sql.SQLClientInfoException;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.List;
/*
Нашествие исключений
*/
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);
}
try {
int [] arr = new int[10];
for (int i = 0; i <=10; i++){
}
}catch (Exception e){exceptions.add(e);}
try {
BufferedReader reader = new BufferedReader(new InputStreamReader(new FileInputStream("E:/t.txt")));
}catch (FileNotFoundException e){exceptions.add(e);}
try {
Dog [] s = new Dog[3];
s[0] = new Dog();
s[0] = null;
System.out.println(s[0].name);
}catch (Exception e){exceptions.add(e);}
try {
int [] arr = new int[-100];
}catch (Exception e){exceptions.add(e);}
/*try {
URL url = new URL("www.google.ru");
} catch (MalformedURLException e) {
exceptions.add(e);
}*/
try {
FileWriter fileWriter = new FileWriter("E:/t.txt");
} catch (IOException e) {
e.printStackTrace();
}
try {
int num = Integer.parseInt("XYZ");
System.out.println(num);
} catch (Exception e) {
exceptions.add(e);
}
try {
Object x[] = new String[3];
x[0] = new Integer(0);
} catch (Exception e) {
exceptions.add(e);
}
try {
String str = "easysteps2buildwebsite";
char c = str.charAt(0);
c = str.charAt(40);
System.out.println(c);
} catch (Exception e) {
exceptions.add(e);
}
String s = null;
try {
Object x = new Integer(0);
s = (String) x;
} catch (ClassCastException e5) {
exceptions.add(e5);
}
try {
throw new Exception();
} catch (Exception e){
exceptions.add(e);
}
try {
int result = getAreaValue(-1, 100);
} catch (Exception e) {
exceptions.add(e);
}
}
public static int getAreaValue(int x, int y) {
if (x < 0 || y < 0) throw new IllegalArgumentException();
return x*y;
}
}
class Dog{
String name;
}