Welcom eto the Ranch
I haven't read your code, because I think the
thread title tells it all.
Have you closed System.in, or a reader/scanner/etc pointing to it? Never close such a scanner/reader, because you close System.in and can never open it again. Have you got two readers trying to read System,in simultaneously? You may be unable to get two readers to point to it, but I am not sure on that point.
I would recommend Scanner for reading from the keyboard. I think most people (and many books) don't use it right. If you give a Scanner the wrong input, you suffer an
Exception. If you look
here, you are supposed to find that particular Exception is only ever used by
Scanner, only that page doesn't seem to be working today
A long time ago,
Rob Spoor pointed out to me that you can avoid that Exception completely like this
Now, I suggest you are going to use that sort of code hundreds of times, so you don't want to write it again. So it belongs in a utility class. If you search my posts for
utility class and
hasNextInt, you will probably find a utility class, or more precisely enough parts of a utility class that you can create your own. So, whenever you want an
int fro mthe keyboard, you call
KeyboardInputs.getInt() (or whatever else you called it) and Bob's your uncle.