ExceptionExample.java:


import java.util.ArrayList;

public class ExceptionExample
{
    public static void main(String[] args)
    {
        try
        {
            ArrayList<String> strs = new ArrayList<String>();
            String s = strs.get(100);
            System.out.println(s);
        }
        catch (Exception x)
        {
            System.err.println("An error occured");
        }
    }
}