At the very end you do return tokens, but this variable was defined by INSIDE in the try block, so it is not available outside of it. You must add:
ArrayList<String> tokens = new ArrayList<String>();
at the top of your method, just under BufferedReader.
source
share