title: How to parse end of line string in Java
body: <p>I would like to read a text file which has some strings such as:</p>
  
  <pre><code>abc  
  def
  
  ghi  
  jkl
  
  mno  
  pqr
  </code></pre>
  
  <p>I am using a while loop to read only a pair and store them in an arraylist. I would like to stop as soon I encounter an empty line (<code>\n</code>) e.g. after <code>def</code>. But my code wont work ... what am I doing wrong?</p>
  
  <pre><code>while(!"\n".equals(sCurrentLine)) {
       -- do stuff --
  }
  </code></pre>