This week's book giveaway is in the OO, Patterns, UML and Refactoring forum. We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma on-line! See this thread for details.
there's nothing wrong in the return of the ArrayList stripping all the readFile code leaves this, which returns OK
your problem must be in the file reading. if the structure of the file is to have the first line indicate how many lines there are: //read first line use for loop int i = Integer.parseInt(br.readLine());
perhaps if you wrap the adding to the arraylist into a conditional object = br.readLine(); list.add(object);
Actually, stripping all the file reading code leaves this (formatting cleaned up):
The problem is that "list" is declared inside the try block, so that it's only visible inside that try block; but the code tries to use it at the last line, which is outside the try, so "list" is undefined.