In JAVA
For practice using exceptions, this exercise will use a try/catch block to validate integer input from a user. Write a brief program to test the user input. Use a try/catch block, request user entry of an integer, use Scanner to read the input, throw an InputMismatchException if the input is not valid, and display "This is an invalid entry, please enter an integer" when an exception is thrown. InputMismatchException is one of the existing Java exceptions thrown by the Scanner if the input does not match the type requested., For more information see this site: InputMismatchException. Submit your working file and execution screenshot. The execution screenshot should show that the exception is thrown and the message is displayed for an invalid input.
Get Answers For Free
Most questions answered within 1 hours.