You are viewing a single comment's thread. Return to all comments →
I found only such way:
try (Scanner scanner = new Scanner(System.in)) { System.out.println(scanner.nextInt()/scanner.nextInt()); } catch (InputMismatchException ex) { System.out.println("java.util.InputMismatchException"); } catch (ArithmeticException ex){ System.out.println(ex); }
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 →
I found only such way: