How can I clear the Scanner buffer in Java?
Try this:
in.nextLine();
This advances the Scanner to the next line.
You can't explicitly clear Scanner's buffer. Internally, it may clear the buffer after a token is read, but that's an implementation detail outside of the porgrammers' reach.