title: Compile error in java :cannot find symbol.
body: <p>I have this code that is taking a text file and turning it into a string and then separating parts of the string into different elements of an arraylist.</p>
  
  <pre><code>import java.util.Scanner;
  import java.io.*;
  import java.util.ArrayList;
  
  public class Grocery{
  
      public Grocery(){
  
          File inFile = new File ("lists.txt");
          Scanner input = new Scanner (inFile);
          String grocery;
          {
               grocery = input.nextLine();
          }
      }
  
      public void makeSmallerLists(){
          String listLine;
          String line;
          ArrayList&lt;String&gt; smallList = new ArrayList&lt;String&gt;();
          while(input.hasNextLine()){
              line = input.nextLine;
              if(line.equals("&lt;END&gt;")){
                  smallList.add(listLine);
              } else{
                  listLine = listLine + "\n" + line;
              }
          }
      }
  }
  </code></pre>
  
  <p>However when I try to compile this it gives me two errors:</p>
  
  <blockquote>
    <p>javac Message.java Message.java:31: cannot find symbol symbol  :
    variable input location: class Message    while(input.hasNextLine()){
            ^ Message.java:32: cannot find symbol symbol  : variable input location: class Message        line = input.nextLine;
                 ^</p>
  </blockquote>
  
  <p>How do I fix this? I really don't know what's wrong.</p>
  
  <p>I fixed that and now my error says
  $ javac Message.java
  Message.java:34: cannot find symbol
  symbol  : variable nextLine
  location: class java.util.Scanner
          line = input.nextLine;
                      ^</p>
  
  <pre><code>           ^
  </code></pre>
  
  <p>Now what is wrong?</p>