My snippet code are as follow:
FileOutputStream fos = new FileOutputStream("newFile.txt");
OutputStreamWriter out = new OutputStreamWriter(fos, "UTF-8");
Writer w = out;
for(String str : arrayName)
{
w.write("sample");
//I wish to insert new line here
}
w.close();
Is there other way than to write a blank space manually? i.e. w.write("\n");
EDITED. Sorry for causing some misunderstanding regarding if I am looking for new line or blank space.
For platform independent way use this:
w.write(System.getProperty("line.separator"));