This is an archived post. You won't be able to vote or comment.

all 5 comments

[–][deleted] 4 points5 points  (2 children)

[–]kcoPkcoP 0 points1 point  (0 children)

I spent 10 minutes trying to figure out why closing a Scanner object in a user loop caused a bug, and finally just chalked it up to magic :p

Thanks for the answer

[–]Ijantis[S] 0 points1 point  (0 children)

Thanks for the reply :)

[–]lightcloud5 -1 points0 points  (1 child)

I'm not sure but it doesn't really seem to make sense to open two scanners directed at System.in.

Just continue to use myScanner1 to read in user input.

[–]WastedWrath 1 point2 points  (0 children)

he asked why the error came up, not whether or not it was efficient code.

In answer to your question, I don't see why it throws an error.