When I try to use scanner.hasNextLine() on my program, it just sits there and hangs. I’m wondering if there is any way to solve this problem or any alternatives I can use.
EDIT: The reason behind this is so that I can remove everything from the scanner (the scanner will only have one line in it). So if there is a way to remove everything from a scanner, that would be easier.
When I try to use scanner.hasNextLine() on my program, it just sits there and
Share
Does this answer your question?
StackOverFlow : why-does-hasnextline-never-end
If not, please put a sample of your code on here to get a more descriptive answer as to what your issue is. Most likely you are reading something that never ends. If you have a file or a string you should not have an issue but if you are reading in a constant stream of data it could potentially hang depending on how your code is written and what you read into the scanner.