Hello,
I'm trying to use the BufferedWriter class to write files to a text file via an ArrayList of strings. Unfortunately I run into a compile-time error about not being able to resolve symbols. Is this a casting issue? Here's the snippet of code I have:
FileWriter wr = new FileWriter(outFileName);
BufferedWriter outFile = new BufferedWriter (wr);
for(int i = 0; i < Stringlist.size(); i++)
{
outFile.write(Stringlist.get(i));
outFile.newLine();
}
I think the "get" method returns an object, but I need a string to make this work. I tried casting the object into a string but I find that it doesn't write anything to the text file. Does anyone have any suggestions?
Thanks,
Jisoo22
I'm trying to use the BufferedWriter class to write files to a text file via an ArrayList of strings. Unfortunately I run into a compile-time error about not being able to resolve symbols. Is this a casting issue? Here's the snippet of code I have:
FileWriter wr = new FileWriter(outFileName);
BufferedWriter outFile = new BufferedWriter (wr);
for(int i = 0; i < Stringlist.size(); i++)
{
outFile.write(Stringlist.get(i));
outFile.newLine();
}
I think the "get" method returns an object, but I need a string to make this work. I tried casting the object into a string but I find that it doesn't write anything to the text file. Does anyone have any suggestions?
Thanks,
Jisoo22