title: Parsing a text file in Java
body: <p>Example from input file:</p>
  
  <pre><code>ARTIST="unknown"
  TITLE="Rockabye Baby"
  LYRICS="Rockabye baby in the treetops
  When the wind blows your cradle will rock
  When the bow breaks your cradle will fall
  Down will come baby cradle and all
  "
  </code></pre>
  
  <p>The Artist, Title &amp; Lyrics fields have to be extracted to their respective Strings with captalization and format unchanged. This code for the Artist field</p>
  
  <pre><code>while (readIn.hasNext()) {
      readToken= readIn.next();
      if (readToken.contains("ARTIST")) {
          artist= readIn.next();
          }
          if (readToken.contains("TITLE")){
              title= readIn.next();
      System.out.print(artist+" "+title);
  }
  </code></pre>
  
  <p>ends up printing this out:<br/></p>
  
  <pre><code>"unknown"
  TITLE null"unknown"
  TITLE null"unknown"
  TITLE
  </code></pre>
  
  <p>From the code, I can't see why the output is printing this way.  For every time through the loop, the readToken string gets refreshed, and should then be compared by the contains() method.  Obviously I'm missing something here.</p>
  
  <p>So, am I close to the right track or am I in a completely different city?</p>