Nikki Smith wrote:. . . Eclipse and my prof both say that I have to though. . . .
In which case both are mistaken.
Carey is correct. You need to learn which of Eclipse's warnings to believe and which to ignore and which to squelch. You can shut Eclipse up with the appropriate annotation:-
@SuppressWarnings("resource")
Check the spelling carefully . . . or use Eclipse's suggestion to add that annotation and it will put the correct spelling in the correct place. Click on the yellow mark and you get a dropdown list of possible corrections. You need to learn which of Eclipse's suggested corrections to believe: in this case adding the annotation.
I am going to give the opposite advice: don't create Scanner objects pointing to System.in. I know you won't believe me, but if you read it carefully you will see I said object
s. You are allowed to create one Scanner object and you should use that for all your keyboard input (as far as possible). The ideal would be for it to be in a utility class of its own. Never close that Scanner because if you do you close System.in and you can never reopen it. That is why you are getting the no such element exceptions. Similarly you can close System.in by feeding it ctrl‑D or ctrl‑Z but both those keystrokes cause the same damage. There are other ways you can close System.in, for example
what the OP in this thread did. All of them will produce the same disastrous result.
I know you have been told to close Scanners but there is one exception to that rule: Scanners pointing to System.in. Always close Scanners pointing to everything else; this is best done with try with resources.