I want to read an input from a text file:




each name is separated by an empty line, i want to get all the names and store them into a arraylist. I am using


will this work because when it hits the empty line, it will stop and come out of the loop right, if so, what is a way to do it?

The empty line is fine. It still ends with a line terminator, so it's not null. Your loop will be fine and you can just ignore the empty string values.