package pl.am.errors.lesson3;
import java.io.FileWriter;
import java.io.IOException;
public class ExceptionExamples {
public static void r() {
r();
}
public static void main(String[] args) throws IOException {
//Wyjątki niekontolowane
//int i = 6/0; //ArithmeticException
int[] numbers = {1, 2, 3};
//System.out.println(numbers[3]); //ArrayIndexOutOfBoundsException
String tekst = "Ola";
//System.out.println(tekst.charAt(3)); //StringIndexOutOfBoundsException
String s = null;
//s.length(); //NullPointerException NPE
//r();
//Wyjątki kontolowane
FileWriter fileWriter = new FileWriter("out.txt");
fileWriter.append("test");
fileWriter.close();
}
}