How to use multiple Scanner objects?
<p>what's the correct way to use multiple Scanner objects in my program. For example, I use scanner to read a file, then depending on what is found in the file, i use scanner again to prompt for user input.  An extract of my code is shown</p>

<pre><code>....
Scanner f = new Scanner (System.in); //get the file name
String fileName = f.next();
Scanner input = new Scanner( new File( fileName ) );
while ( input.hasNext() )
{
   String currentLine = input.nextLine();
   if ( some pattern found) {
       Scanner getUserInput = new Scanner (System.in);
       String userInput = getUserInput.next();
       .....
   }
}
....
</code></pre>

<p>It doesn't seem to work. Do I need to use <code>userInput.close()</code> ? What am i doing wrong. ?</p>

<p>What I don't understand is, the first <code>System.in</code> is just getting the file name. After that, why does it interfere with the second <code>System.in</code>. 
As for the <code>input</code> object, its reading from a  File and not from <code>System.in</code>. </p>
