How do make output have more than one string (Java)
<p>I asked a similar question before regarding I/O using Java.</p>

<p>I'm trying to copy a list of strings into another file.</p>

<pre><code>package file;

import java.io.BufferedReader;
import java.io.FileReader;
import java.io.IOException;

public class File {

    public static void main(String[] args) {

                FileWrite fW = new FileWrite();

                try (BufferedReader br = new BufferedReader(new FileReader("B:\\inLarge.dat")))
        {

            String stCurrent;

            while ((stCurrent = br.readLine()) != null) {
                System.out.println(stCurrent);
                                fW.serializeAddress(stCurrent, stCurrent);
            }

        } catch (IOException e) {
            e.printStackTrace();
        } 


                //fW.serializeAddress("Boston", "Canada");
    }
}
</code></pre>

<p>And</p>

<pre><code>package file;

import java.io.BufferedWriter;
import java.io.FileOutputStream;
import java.io.FileWriter;
import java.io.ObjectOutputStream;
import java.io.PrintStream;
import java.io.Serializable;
import java.io.File;
import java.io.IOException;

public class FileWrite {

   public void serializeAddress(String city, String country){

       try
           {

               File file = new File("B:\\outLarge.txt");

               if (!file.exists()) 
                        {
                file.createNewFile();
            }

               FileWriter fw = new FileWriter(file.getAbsoluteFile());
               BufferedWriter bw = new BufferedWriter(fw);
               bw.write(city + " " + country);
               bw.close();

            System.out.println("Done");



       }
           catch(Exception ex)
           {
           ex.printStackTrace();
       }
   }
}
</code></pre>

<p>But the ending output file has only one result, how do I make it copy everything?
I am thinking buffered-writer somehow needs to be in the loop to write new ones on top of existing ones? But not sure how to implement that.</p>

<p>Thanks a lot.</p>
