You are viewing a single comment's thread. Return to all comments →
May be because you are using older version of java. In java 8 this code passes all the testcases successfully.
try { int a=obj.nextInt(); int b=obj.nextInt(); System.out.print(a/b); } catch(InputMismatchException e) { System.out.print(e.getClass().getName()); } catch(Exception e) { System.out.print(e); }
Seems like cookies are disabled on this browser, please enable them to open this website
Java Exception Handling (Try-catch)
You are viewing a single comment's thread. Return to all comments →
May be because you are using older version of java. In java 8 this code passes all the testcases successfully.