title: Reading From RandomAccessFile
body: <p>I am reading 10 lines from a simple RandomAccessFile and printing each line. The exact lines in the text file are as follows one after the other:</p>
  
  <p>blue</p>
  
  <p>green</p>
  
  <p>bubble</p>
  
  <p>cheese</p>
  
  <p>bagel</p>
  
  <p>zipper</p>
  
  <p>candy</p>
  
  <p>whale</p>
  
  <p>monkey</p>
  
  <p>chart</p>
  
  <p>When printing them in order as I read line by line my output is this:</p>
  
  <p>green</p>
  
  <p>cheese</p>
  
  <p>zipper</p>
  
  <p>whale</p>
  
  <p>chart</p>
  
  <p>I cannot understand why my method is skipping every other line in the file. Am I misunderstanding how a RandomAccessFile works? My method is below:</p>
  
  <pre><code>RandomAccessFile file = new RandomAccessFile(FILEPATH, "rw");
      read(file);
  
  public static void read(RandomAccessFile t) throws IOException{
      while (t.readLine()!=null) {
          System.out.println(t.readLine());
      }
  }
  </code></pre>