fork download
  1. class exception_handling {
  2. public static void main(String args[]) {
  3. try {
  4. int a = args.length;
  5. int b = 10 / a;
  6. System.out.print(a);
  7. try {
  8. if (a == 1)
  9. a = a / a - a;
  10. if (a == 2) {
  11. int c = {1};
  12. c[8] = 9;
  13. }
  14. }
  15. catch (ArrayIndexOutOfBoundException e) {
  16. System.out.println("TypeA");
  17. }
  18. catch (ArithmeticException e) {
  19. System.out.println("TypeB");
  20. }
  21. }
  22. }
  23. }
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
Main.java:3: error: 'try' without 'catch', 'finally' or resource declarations
            try {
            ^
1 error
stdout
Standard output is empty