Java- FileWriter/BufferedWriter - appending to end of a text file?
Posted
by KP65
on Stack Overflow
See other posts from Stack Overflow
or by KP65
Published on 2010-03-04T13:51:00Z
Indexed on
2010/04/06
23:23 UTC
Read the original article
Hit count: 275
I've done this before once, I'm trying to replicate what I did so far and this is what I've got:
try {
BufferedWriter writer = new BufferedWriter(new FileWriter("file.P", true));
System.out.println("entered");
if (!(newUserName.isEmpty()) || (newUserPass.isEmpty())){
writer.newLine();
writer.write("hellotest123");
writer.close();
}
It seems to find file.P, which is just a txt file, but it doesn't seem to append anything onto it? It enters the code and passes the IF statement fine, but nothing is appended to the text file? I'm slightly stuck!
© Stack Overflow or respective owner