public class Solution {
    public static void main(String[] args) throws Exception {
        try {
            ArrayList<String> list = new ArrayList<String>();
            String s = list.get(18);
        } catch (IndexOutOfBoundsException e) {
            String s = e.getClass().toString(); // ЧТО ДЕЛАЕТ ЭТА СТРОКА? ПОЧЕМУ БЕЗ НЕЕ НЕ РАБОТАЕТ?
            System.out.println(s);
        }
    }
}