title: Passing scanner to a method
body: <p>Just a basic newbie question I can't see to find a good answer to online.</p>
  
  <p>I'm writing code for a course and I am finding myself passing scanner to quite a few methods.</p>
  
  <p>First question is generally speaking is this frowned upon? Presses a key will it disrupt during runtime? </p>
  
  <pre><code>        // Countinously prompt the user for a file.
      Scanner input = null;        
      while ( input == null ){
          System.out.println ( "What is the name of the file containing each student's responses to the 10 questions? " );
          try {
              input = new Scanner ( new File ( in.nextLine ( ) ));
          } catch ( FileNotFoundException e ) {
                System.out.println ( "You must input a valid file name." );
          }
      }
  
      //Print and store student answers
      ArrayList &lt;String&gt; answers = new ArrayList &lt;String&gt; ();
      studentResponses ( input, answers );
  
      //Analyze the answers
      ansAnalysis( input );
  </code></pre>
  
  <p>as you can see I pass scanner to a few methods, as a beginner just not use to it and figured I'd have seen more examples if this was a common technique. I suppose I could create another object, but this seems easier. </p>