fork download
  1. import java.util.*;
  2.  
  3. class Example {
  4. public static void main(String[] args) {
  5. try {
  6. new ArrayList<>().get(0);
  7. } catch (Throwable e) {
  8. System.out.println(e.getClass());
  9. }
  10. try {
  11. new ArrayList<>().get(-1);
  12. } catch (Throwable e) {
  13. System.out.println(e.getClass());
  14. }
  15. }
  16. }
Success #stdin #stdout 0.04s 2184192KB
stdin
Standard input is empty
stdout
class java.lang.IndexOutOfBoundsException
class java.lang.ArrayIndexOutOfBoundsException