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
You can add the lines to a List, e.g. a LinkedList. When the list has more than five lines, remove the first/last.
List
LinkedList
List lines = new LinkedList(); for(String tmp; (tmp = br.readLine()) != null;) if (lines.add(tmp) && lines.size() > 5) lines.remove(0);