title: The method is undefined for the type Object issue
body: <p>I get the following errors: the method getOdometer &amp; getGallons are undefined for the type Object. Here is my code. My issue is in the main method, in the while loop where I'm using my accessor methods. Why isn't this working and how can I fix it? I'm new to programming so don't give me any answers that are too complicated. Thank you for your answers.</p>
  
  <p>The program I'm trying to make reads from a file and grabs the odometer and gallons that the car filled up at that odometer. I was told to use a helper method to grab those numbers from the file and calculate the mileage in the main method after I return the arraylist of FillUp objects from my FillUpArray helper method. </p>
  
  <pre><code>package lab8;
  import java.io.File;
  import java.util.Scanner;
  import java.io.FileNotFoundException;
  import java.util.ArrayList;
  
  
  public class CheckpointOne {
  public static void main(String[] args) throws FileNotFoundException
  {
      File file = new File("C:/Users/Nick/workspace/project8/mileage.txt");
      Scanner scan = new Scanner(file);
      double mileage=0.0;
      int i=0;
      while(i+1&lt;fillUpArray(scan).size())
      {
          mileage=(fillUpArray(scan).get(i+1).getOdometer()-fillUpArray(scan).get(i).getOdometer())/fillUpArray(scan).get(i+1).getGallons();
          System.out.println("Mileage: "+mileage);
          i++;
      }
  }
      private static ArrayList fillUpArray(Scanner scan)
      {
          ArrayList&lt;FillUp&gt; list = new ArrayList&lt;FillUp&gt;();
          int odometer=0;
          double gallons=0.0;
          while(scan.hasNextLine())
          {
              String line = scan.nextLine();
              Scanner scans = new Scanner(line);
              while(scans.hasNext())
              {
                  odometer=scans.nextInt();
                  gallons=scans.nextDouble();
              }
              FillUp fill = new FillUp(odometer, gallons);
              list.add(fill);
          }
          return list;
      }
  
  
  }
  </code></pre>
  
  <p>And this is my FillUp class that I'm using. </p>
  
  <pre><code>package lab8;
  
  public class FillUp
  {
    private final int odometer;
    private final double gallons;
  
    public FillUp(int givenOdometer, double givenGallons)
    {
      odometer = givenOdometer;
      gallons = givenGallons;
    }
  
    public int getOdometer()
    {
      return odometer;
    }
  
    public double getGallons()
    {
      return gallons;
    }
  }
  </code></pre>