Check out example codes for "how to write between lines in a file in java". It will help you in understanding the concepts better.

Code Example 1

RandomAccessFile file = new RandomAccessFile("c:\\data\\file.txt", "rw");

file.write("Hello World".getBytes());

file.close();

Code Example 2

RandomAccessFile file = new RandomAccessFile("c:\\data\\file.txt", "rw");

file.seek(200);

long pointer = file.getFilePointer();

file.close();

Learn ReactJs, React Native from akashmittal.com