I am trying to write the console output to the text file (Data.txt) so here is my code:
PrintStream out = new PrintStream(new File("/home/cse/Desktop/Data.txt"));
System.setOut(out);
out.print("");
When I run the program again after I have once run it, the output replaces the old data that was present in the Data.txt file. But I want it to continue adding the data from where it had stopped earlier. How can I do this?