fork download
  1. /* package whatever; // don't place package name! */
  2.  
  3. import java.util.*;
  4. import java.lang.*;
  5. import java.io.*;
  6.  
  7. class Test
  8. {
  9. public static void main(String[] args)
  10. {
  11. try
  12. {
  13. int a[]= {1, 2, 3, 4};
  14. for (int i = 1; i <= 4; i++)
  15. {
  16. System.out.println ("a[" + i + "]=" + a[i] + "\n");
  17. }
  18. }
  19.  
  20. catch (Exception e)
  21. {
  22. System.out.println ("error = " + e);
  23. }
  24.  
  25. {
  26. System.out.println ("ArrayIndexOutOfBoundsException");
  27. }
  28. }
  29. }
  30.  
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
Main.java:25: error: exception ArrayIndexOutOfBoundsException has already been caught
catch (ArrayIndexOutOfBoundsException e)
^
1 error
stdout
Standard output is empty