title: Simple java program won't read file
body: <p>I am very new to programming and am having a lot of trouble trying to read data from a text file.</p>
  
  <ol>
  <li><p>My first problem arose trying to create a new Scanner object for my file. I got a "file not found" error unless I added .getAbsolutePath() after the file object.</p></li>
  <li><p>Now, I can't seem to read any data from the file. When I try to print each line in the file I get no output.</p></li>
  </ol>
  
  <p>I assume I'm just missing something very obvious. Can anyone help me out? </p>
  
  <pre><code>public static void main(String[] args) {
      File inputFile = new File("menu.txt");
      System.out.println("Reading from file" + inputFile);
      Scanner inputScanner = new Scanner(inputFile.getAbsolutePath());
      String answer;
  
      while (inputScanner.hasNextLine()){
          answer = inputScanner.nextLine();
          System.out.println(answer);
  
      }
  }
  </code></pre>
  
  <p>EDIT: I originally was passing the file object into my creation of the scanner object, but was still getting the error. </p>