I am trying to write the contents of my ArrayList to a text file which is already created in my G drive ( the path has been mentioned below ). I am using BufferedWriter to write the contents of the Arraylist into the text file
It compiles without any errors but somehow the textfile- sampleOutput.txt is empty. Any ideas why this is so ?
public void WriteOutput( ArrayList<detailTom> tomData1)
{
try
{
BufferedWriter writer = new BufferedWriter(new FileWriter("G:/sampleOutput.txt"));
for (detailTom detail : tomData1)
{
writer.write(detail.toString());
}
}
catch (IOException ex)
{
Logger.getLogger(MyInterface.class.getName()).log(Level.SEVERE, null, ex);
}
}