I have a text file that consists of several entries such as:
hello there my name is JoeBloggs
How would I read the last five entries in des
If all it really does have to do is print last 5 lines:
ArrayList lines = new ArrayList(); String tmp=""; while ((tmp = br.readLine()) != null) { lines.add(tmp); } for (int i = lines.size()-5; i < lines.size(); i++) { System.out.println(lines.get(i-1)); }