title: How to read a file into string in java?
body: <p>I have read a file into a String. The file contains various names, one name per line. Now the problem is that I want those names in a String array.</p>
  
  <p>For that I have written the following code:</p>
  
  <pre><code>String [] names = fileString.split("\n"); // fileString is the string representation of the file
  </code></pre>
  
  <p>But I am not getting the desired results and the array obtained after splitting the string is of length 1. It means that the "fileString" doesn't have "\n" character but the file has this "\n" character.</p>
  
  <p>So How to get around this problem?</p>