fork download
  1. import java.util.*;
  2. class Division3a
  3. {
  4. public static void main(String []args)
  5. {
  6. int a,b,result;
  7. Scanner inp=new Scanner(System.in);
  8. System.out.println("Input two Integers");
  9. a=inp.nextInt();
  10. b=inp.nextInt();
  11. try
  12. {
  13. result=a/b;
  14. System.out.println("Result of "+a+"and "+b+"is="+result);
  15. {
  16. System.out.println("Exception caught Division by zero:ie., b is zero");
  17. }
  18. }
  19. }
  20. }
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
Main.java:15: error: 'catch' without 'try'
catch(ArithmeticException e)
^
Main.java:11: error: 'try' without 'catch', 'finally' or resource declarations
try
^
2 errors
stdout
Standard output is empty