title: Reading a file line by line while storing an object in an array for each line
body: <p>I have a text file with a maximum of 4 lines to read from. Each line has a mixture of strings and integers spaced out by tabs.</p>
  
  <p>I have successfully made my program read 1 line and store all the information in the appropriate spot, while also storing a new object in the array. </p>
  
  <p>The problem: I can't figure out how to get it to read multiple lines while also storing a new object in the array depending on the line read.</p>
  
  <p>Here is my method that takes the file and and stores an object in the array:</p>
  
  <pre><code>public void addVehicle(Vehicle Honda[]) throws FileNotFoundException
  {
      Scanner reader = new Scanner(file);
  
          if(canAddVehicle() == true)
          {
          for(int i = 0; i &lt; vehicles.length; i++)
          {
              if(vehicles[i] == null)
              {
                  Honda[i] = new Vehicle();
                  Honda[i].readRecord(reader);
                  vehicles[i] = Honda[i];
                  reader.close();
                  break;
              }
          }
              System.out.println("Vehicle Added!");
          }
          else
          {
              System.out.println("You can not add more than 4 vehicles.");
          }
  }
  </code></pre>
  
  <p>And the readRecord() method:</p>
  
  <pre><code>public void readRecord(Scanner reader)
  {
      while(reader.hasNextLine())
      {
          setMake(reader.next());
          setModel(reader.next());
          setYear(reader.nextInt());
          setvin(reader.next());
          setValue(reader.nextDouble());
          setMilesDriven(reader.nextInt());
          setLastOilChange(reader.nextInt());
      }
      reader.close();
  }
  </code></pre>