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
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…