title: Writing to the line in Reverse Order
body: <p>I want to write the lines in reverse order like
  Input: line 1.line 2.line 3.
  Output: line 3. line 2. line 1.            </p>
  
  <p>This is the following code. </p>
  
  <pre><code>{            
      FileReader fr = new FileReader("src/file/in.txt");
      FileWriter fw = new FileWriter("src/file/out.txt");
      BufferedWriter bw = new BufferedWriter(fw);
      BufferedReader buffer = new BufferedReader(fr);
      String msg =buffer.readLine();
      String[] words = msg.split ("\\.");
      System.out.println( "The reversed words are : ");
      for(int x = words.length - 1; x &gt;=0; x--) {
          bw.write(words[x] + " "); 
      } 
      bw.close();
      fr.close();
  }
  </code></pre>