title: read complete file without using loop in java
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><br>
    <a href="https://stackoverflow.com/questions/3849692/whole-text-file-to-a-string-in-java">Whole text file to a String in Java</a>  </p>
  </blockquote>
  
  
  
  <p>I am trying to read the contents of a file using FileReader . But i want to read the file without reading a line by line . Is it possible to read the whole file without loop.
  I am using the following code</p>
  
  <pre><code> try
   {
       File ff=new File("abc.txt");
       FileReader fr=new FileReader(ff);
  
       String s;
       while(br.read()!=-1)
       {
            s=br.readLine();
       }
   }
  
   catch(Exception ex)
   {
       ex.printStackTrace();
   }
  </code></pre>