What is the best way to flush the buffer of a Scanner?
somescanner.nextLine() clears the buffer if it is not empty, butotherwise i get an extra nextLine.

Actually you call the nextLine, if the previous call was a next() call or a nextInt() call.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.