Check out example codes for "read and write files pattern java". It will help you in understanding the concepts better.

Code Example 1

// Java Program to illustrate reading from FileReader 
// using BufferedReader 
public class ReadFromFile2 
  public static void main(String[] args)throws Exception 
  // We need to provide file path as the parameter: 
  // double backquote is to avoid compiler interpret words 
  // like \test as \t (ie. as a escape sequence) 
  File file = new File("C:\\Users\\pankaj\\Desktop\\test.txt"); 
  BufferedReader br = new BufferedReader(new FileReader(file)); 
  String st; 
  while ((st = br.readLine()) != null) 

Learn ReactJs, React Native from