I have this code and I want to catch the letter exception but it keeps having these errors:
Exception in thread \"main\" java.util.InputMismatchException
Reading data from Scanner and assigning it to Int type. Since you are supplying String this will throw exception. To handle this situation you must write your snippet inside Try- Catch block only.