Java has two kinds of exception: checked and runtime. : Exception « Statements « SCJP






You are free to call methods that throw runtime exceptions, without enclosing the calls in try blocks.

public class MainClass{
    public static void main(String[] argv){
        int[] i = new int[3];
        
        System.out.println(i[10]);
    }
}
Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException: 10
	at MainClass.main(MainClass.java:5)








5.11.Exception
5.11.1.All exceptions descend from the java.lang.Throwable superclass
5.11.2.Declaring Exceptions
5.11.3.Java has two kinds of exception: checked and runtime.
5.11.4.Runtime Exceptions descend from RuntimeException class
5.11.5.Objects of type Error are not Exception objects