You are viewing a single comment's thread. Return to all comments →
Scanner scanner = new Scanner(System.in); try { int x = scanner.nextInt(); int y = scanner.nextInt(); System.out.println(x/y); } catch (ArithmeticException e) { System.out.println(e); } catch (InputMismatchException e) { System.out.println(e.getClass().getName()); }
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 →