I want to write an ArrayList into a text file.
The ArrayList is created with the code:
ArrayList arr = new A
You can do that with a single line of code nowadays. Create the arrayList and the Path object representing the file where you want to write into:
Path out = Paths.get("output.txt");
List arrayList = new ArrayList<> ( Arrays.asList ( "a" , "b" , "c" ) );
Create the actual file, and fill it with the text in the ArrayList:
Files.write(out,arrayList,Charset.defaultCharset());