title: Read and Write to text file in java
body: <p>I'm trying to add values in a textfile. Its working well and output is good in eclipse.
  But when i see the values in file, i get a straight pattern : 2526272829.</p>
  
  <pre><code>import java.io.BufferedReader;
  import java.io.BufferedWriter;
  import java.io.File;
  import java.io.FileNotFoundException;
  import java.io.FileReader;
  import java.io.FileWriter;
  import java.io.IOException;
  import java.io.InputStreamReader;
  
  public class FileDemo {
      public static void main(String[] args) throws IOException {
          BufferedReader bfr;
          String line;    
          bfr=new BufferedReader(new InputStreamReader(System.in));
          String fileName=bfr.readLine();
          File file=new File(fileName);       
          if(!file.exists()){
              file.createNewFile();
          }       
          try{
              bfr=new BufferedReader(new FileReader(file));
  
              while((line=bfr.readLine())!=null){
                  System.out.println(line);
              }
              FileWriter fw=new FileWriter(file,true);            
              for(int i=25;i&lt;30;i++){                 
                  fw.append(String.valueOf(i));
              }
  
              while((line=bfr.readLine())!=null){
                  System.out.println(line);
              }
              bfr.close();
              fw.close();
  
          }catch(FileNotFoundException fex){
              fex.printStackTrace();
          }
  
      }
  }
  </code></pre>
  
  <p>and i also want to know how bufferedReader storage works so please give some links.</p>