0

I want to read an input from a text file:

Test1.jpg

Test2.jpg

Test3.jpg

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

while((line=inputFile.readLine())!=null)

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?

2
Contributors
1
Reply
2
Views
7 Years
Discussion Span
Last Post by Ezzaral
0

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.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.