title: Printing a new line in a file, in Java
body: <p>I aim to make an index of all files with a particular extension and store it into index.txt. I am getting all the right results but not getting the 'files' onto the new line, this is a snapshot of my code:</p>
  
  <pre><code>OutputStream f0 = new FileOutputStream("index.txt");
      String ind[] = f.list(only); // logic for getting only relevant files
          for(int i=0;i&lt;ind.length;i++)
          {
              File n = new File(path + "/" +ind[i]);
                  System.out.println(ind[i]+ " is a " +exten +" file");
                  ind[i]+="\n";           // doesnt work      
                  f0.write(ind[i].getBytes());    // here i am writing the filenames                              
          }           
  </code></pre>
  
  <p>is it due to the getBytes() function which overlooks the "/n" ? Please tell me what to do. I want to insert a new line everytime i exit the for loop.</p>
  
  <p>One major edit: I am getting the desired result when I open the file with notepad++ or wordpad, but when i open the file with notepad i am getting the results on the same line. Please Explain this too! </p>