title: How to use the same Scanner across multiple classes in Java
body: <p>I have a program that uses multiple classes, I want the other classes to be able to access the same scanner that I have declared in the main class, I assume it would be done using some sort of get method, however I am unable to find any resources to help me. </p>
  
  <p>Here are the Scanners that I have made in my main class:</p>
  
  <pre><code>  Scanner in = new Scanner(System.in);
              System.out.println("Enter a filename");
              String filename = in.nextLine();
              File InputFile = new File (filename);
              Scanner reader = new Scanner(filename);
  </code></pre>
  
  <p>The reader Scanner is the one I want to be able to access across the other classes that make up the program, can anyone give me some guidance on how I can do this? Thanks a lot for any help!</p>