Check out example codes for "edit a txt file using java". It will help you in understanding the concepts better.

Code Example 1

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

Learn ReactJs, React Native from akashmittal.com