Richard,
Welcome to CodeRanch! I've added code tags to make your post easier to read
Boiling your question down into a shorter one, we have the question of why the following doesn't work if you enter the number in quotes.
Input: "1"
Output:
Exception in
thread "main" java.util.InputMismatchException
at java.util.Scanner.throwFor(Scanner.java:909)
at java.util.Scanner.next(Scanner.java:1530)
at java.util.Scanner.nextInt(Scanner.java:2160)
at java.util.Scanner.nextInt(Scanner.java:2119)
at jb.PlayTest.main(PlayTest.java:11)
The reason is because Java is looking for only numbers. To deal with this you have three choices:
1) Read a
String instead of an integer, strip out the quotes (or other special characters) and call Integer.parseInt()
2) Catch the exception and have the user re-enter the numeric choice.
3) Let the program crash (granted this isn't a good choice)