Must I declare RandomAccessFile raf = new RandomAccessFile("foo.txt", "rw"); within a main method or constructor? My IDE seems to insist on it. Can I not just declare it within a class?
Make sure you have an import statement for RandomAccessFile, that is just about the only thing I can think of that could cause a problem with this statement. Though people say I don't have a big enough imagination so...