title: How to set String equal to text in .txt file
body: <blockquote>
    <p><strong>Possible Duplicate:</strong><br>
    <a href="https://stackoverflow.com/questions/326390/how-to-create-a-java-string-from-the-contents-of-a-file">How to create a Java String from the contents of a file</a>  </p>
  </blockquote>
  
  
  
  <p>I have a .txt file that I want to save in a String variable.  I imported the file with <code>File f = new  File("test.txt");</code>. Now I am trying to put the contents of it in a <code>String</code> variable. I can not find a clear explanation for how to do this.</p>