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