Hi, I am new to Java and am trying to write a piece of code which will read from a text file and extract words ending with a question mark. I would like to be able to move forwards and backwards through a file. I've tried using FileReader but the read method only goes forwards. How can I then read the previous character? Could I read the whole file into a String and then use that instead? Thanks, Mike
It sounds like you don't really need the full power of random access (although it is an option -- see RandomAccessFile or in Java 1.4 FileChannel). If you're extracting words, the first (simplest) solution that comes to mind first is to read in the file line by line and then process each line as a String.