Didn't I tell you? Put a print instruction in the loop which reads your file and verify that it prints three things. You will get nothing helpful from a Map in the writing method.
Adam Chalkley wrote:hey Campbell I'm not too sure how I would do that, . . .
// just prints Adam
Norm Radder wrote:The write and writeInt methods write different values to the file.
A “normal” try‑catch isn't ideal for closing resources; you should really use a finally, otherwise there is a risk of the reader not being closed. Try with resources obviates the need for the finally.
Adam Chalkley wrote:. . . try with resources over the normal try catch block method?
What random access file? If you have a text file, treat it as a text file. You will have to use a reader or a Scanner. You won't use any EOFs (I have already mentioned my opinion of EOFs), but you can test for the end of the file differently.
Adam Chalkley wrote:. . . the file random.txt . . .
You don't appear to be adding anything to the StringBuilder.
but when I run the program I get no out put onto the console(when I print Stringbuilder) . . .