Sample Output

Classic programmed-learning exercises, refreshed for modern Java and presented in the current MrStyner.com portfolio style.

Modern Java noteThis archive has been refreshed for Java 25 LTS. Core language concepts remain useful, while outdated setup instructions and browser-era Java are labeled or replaced. Java 26 is the current feature release; Java 25 is used here as the stable teaching baseline.
go to previous page   go to home page   go to next page        

Answer:

Yes―any statements can be inside the block, not just statements that might throw exceptions.

Sample Output

Here is some output from the program:

Enter an integer: rats
You entered bad data.
Please try again.

Enter an integer:
-12
The square of -12 is 144

QUESTION 9:

If the user entered 34.56 would a InputMismatchException be thrown?