Scanner not closing/resetting
steehs1532 (2)

Hi, I need to be able to scan a file multiple times depending on user input and when I close my scanner and make a new one it doesn't seem to be opening up a new file.

Code: https://repl.it/@steehs1532/project
Error Example:
What would you like to monitor? Please type 'animal', 'habitat', or 'exit'.
Details on lions
Details on tigers
Details on bears
Details on giraffes
Please type animal from the list above (ie. lion)
Animal - lion
Name: Leo
Age: 5
*Health concerns: Cut on left front paw
Feeding schedule: Twice daily
What would you like to monitor? Please type 'animal', 'habitat', or 'exit'.
Exception in thread "main" java.util.NoSuchElementException: No line found
at java.util.Scanner.nextLine(Scanner.java:1540)
at Main.main(Main.java:38)
exit status 1

You are viewing a single comment. View All
Answered by vedprad1 (435) [earned 5 cycles]
View Answer
vedprad1 (435)

I might be able to help you on this. However, the url you have posted is the final product, not the actual code. Is this your code: https://repl.it/@steehs1532/project ? If it is, I will check it and see if I can find a mistake.

steehs1532 (2)

@vedprad1 Yes, sorry that is the code