Check out example codes for "how to convert line into string java". It will help you in understanding the concepts better.
Code Example 1
File file = new File(fileName);
Scanner input = new Scanner(file);
List<String> list = new ArrayList<String>();
while (input.hasNextLine()) {
list.add(input.nextLine());
}
//adds each line of a text file into an ArrayList
Learn ReactJs, React Native from akashmittal.com