Well, you could use my method but instead of making it a huge string, save each string to a list:
In your class, define a new variable:
Then, use this code:
To get something from the list, use this:
ArrayList<String> out = new ArrayList<String>();
public void load() throws Exception { BufferedReader in = new BufferedReader(new FileReader("a.txt")); int num = 0; //File Line Count String t = ""; int start = Integer.parseInt(in.readLine()); //First number in file while((t = in.readLine()) != null) //Ensures that there is something to read { num++; //Increase num by 1 //do stuff with the string 't' which has each line of file every time out.add(t); //Adds the contents of the line to the list } in.close(); }
String thirdLine = out.get(2); //subtract one from wanted line.