Check out example codes for "java output array lists to file". It will help you in understanding the concepts better.

Code Example 1

import java.io.FileWriter;
...
FileWriter writer = new FileWriter("output.txt"); 
for(String str: arr) {
  writer.write(str + System.lineSeparator());
}
writer.close();

Learn ReactJs, React Native from akashmittal.com