[Solved] I can’t catch InputMismatchException [closed]


An exception is captured only if the statement that produce the exception is inside a try-catch statement.

You need to place int choosenCharacter=scan.nextInt(); inside the try block, and then the exception will be captured by the catch

solved I can’t catch InputMismatchException [closed]