1
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'.
animal
Details on lions
Details on tigers
Details on bears
Details on giraffes
Please type animal from the list above (ie. lion)
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'.
animal
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 (439) [earned 5 cycles]
View Answer
1
steehs1532 (2)

@vedprad1 Yes, sorry that is the code