edit a txt file using java

Java
FileWriter fw = new FileWriter ("file.txt", true);
PrintWriter pw = new PrintWriter (fw);
/*
filewriter creates the file that printwriter can edit.
*/
Source

Also in Java: