title: Writing a Tokenized string into a text file?
body: <p>I'm trying to save a tokenized string into a .txt file...
  Example, in <code>Read.txt</code> is:</p>
  
  <p><code>She sells, sea shells, by the sea shore.</code></p>
  
  <p>I got my program to tokenize it but i can't seem to save the tokenized string into <code>Write.txt</code></p>
  
  <p>In <code>Write.txt</code> I just get:</p>
  
  <p><code>She sells, sea shells, by the sea shore.</code></p>
  
  <p>Basically I want to save what I output into <code>Write.txt</code></p>
  
  <p>Any help would be appreciated :D</p>
  
  <p>Here are my outputs:</p>
  
  <pre><code>She sells, sea shells, by the sea shore.
  
  [Split by spaces.]
  
  She 
   sells,
   sea shells,
   by
   the
   sea
   shore.
  
  -----------------------------
  
  [Split by commas.]
  
  She sells
   sea shells
   by the sea shore.
  </code></pre>
  
  <p>And my current codes:</p>
  
  <pre><code>import java.io.*;
  import java.util.StringTokenizer;
  
  
  public class readWriteTokenized{
  public static void main( String[] args ){
  
      String readString;
  
      try{
          BufferedReader br = new BufferedReader( new FileReader("Read.txt"));
  
          readString = br.readLine();
          System.out.println("\n" + readString);
  
          br.close();
  
  
          StringTokenizer stnz = new StringTokenizer(readString);
  
          System.out.println("\n[Split by spaces.]\n");
          while( stnz .hasMoreTokens()){
              System.out.println(stnz .nextToken());
          }
  
  
          StringTokenizer stnz2 = new StringTokenizer(readString, ".");
  
          System.out.println("\n-----------------------------");
          System.out.println("\n\n[Split by comma.]\n");
          while( stnz2.hasMoreTokens()){
              System.out.print(stnz2.nextToken());
          }
  
  
          File NewTextFile = new File("C:/TestJava/Write.txt");
  
          FileWriter fw = new FileWriter(NewTextFile);
          fw.write(readString);
          fw.close();     
      }
      catch (IOException e){
          System.out.println("Catch error!");
      }       
    }
  }
  </code></pre>