Reply to comment
Append String to Text File in Java
Tagged:
import java.io.File;
import java.io.FileWriter;
import java.io.IOException;
public class AppendToFile {
public static void main(String[] args)
throws IOException {
String path = "/home/jr/Desktop/file1.txt";
String text = "add this text";
File file = new File(path);
FileWriter writer = new
FileWriter(file, true);
writer.append(text);
writer.close();
}
}

Recent comments
5 days 3 hours ago
2 weeks 4 days ago
3 weeks 1 hour ago
3 weeks 1 hour ago
4 weeks 2 days ago
4 weeks 5 days ago
4 weeks 5 days ago
6 weeks 1 day ago
7 weeks 3 days ago
7 weeks 3 days ago