





















Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!






















Exception in thread “main” java.lang.InputMismatchException at java.util.Scanner.throwFor(Scanner.java:819) at java.util.Scanner.next(Scanner.java:1431) at java.util.Scanner.nextInt(Scanner.java:2040) at java.util.Scanner.nextInt(Scanner.java:2000) at Ch8Sample1.main(Ch8Sample1.java:35) Error message for invalid input
try catch
No Exception try { <t-stmt-1>
... <t-stmt-i> ... <t-stmt-n> } <catch-block-1> ... <catch-block-i> ... <catch-block-m> } finally { ... }
try { B(); } catch (Exception e){
... }
try { C(); } catch (Exception e){
... }
try { D(); } catch (Exception e){
...
if (cond) { throw new Exception();