posted 18 years ago
In general, nextInt() would block waiting for new input. The problem here is that System.in has already been closed, near the top of the method. Closing the scanner also closes the stream it's wrapped around. Once it's been closed, you can't reopen it. So when you later create a new Scanner wrapped around System.in, it can't possibly read anything - hence, the error you've gotten.
If you want to use System.in more than once, you need to create a single Scanner for reading System.in, and keep using it. Don't close it until you're really done with it, and don't try to create a new one.
"I'm not back." - Bill Harding, Twister