Open mikhi-mh opened 1 year ago
Updated Solution.java We can use toString Method instead of our string Just observe the print statements of catch...
try{ int x = input.nextInt(); int y = input.nextInt(); System.out.println(x/y); } catch(InputMismatchException e){ // System.out.println("java.util.InputMismatchException"); System.out.println(e.getClass().getName()); } catch(ArithmeticException e){ // System.out.println("java.lang.ArithmeticException: / by zero"); System.out.println(e.toString()); }
Updated Solution.java We can use toString Method instead of our string
Just observe the print statements of catch...