Check out example codes for "file append in java". It will help you in understanding the concepts better.

Code Example 1

File file = new File("append.txt");
FileWriter fr = new FileWriter(file, true);
BufferedWriter br = new BufferedWriter(fr);
PrintWriter pr = new PrintWriter(br);
pr.println("data");
pr.close();
br.close();
fr.close();

Code Example 2

File file = new File("append.txt");
FileWriter fr = new FileWriter(file, true);
BufferedWriter br = new BufferedWriter(fr);
br.write("data");

br.close();
fr.close();

Code Example 3

File file = new File("append.txt");
FileWriter fr = new FileWriter(file, true);
fr.write("data");
fr.close();

Learn ReactJs, React Native from akashmittal.com