I take multiple lines as a input from a JTextarea,
If I write it in a file, then I get that the multiple lines are write in a one line in file
Examples:
In JTextArea:
I
am
a
student
Means: variable.text="I’\n’am’\n’a’\n’student";
When I write the string s in file I get:
I am a student
But I want that the file will contain the same things as I give as a input means—>
I
am
a
student
This is the code of writing a file :
BufferedWriter out = new BufferedWriter(
new OutputStreamWriter(
new FileOutputStream(file), "UTF16"));
int size=1;
for(Tableclass variable:tablevector)
{
out.write(variable.Text);
out.newLine();
size++;
}
out.close();
Slighty better version would be :