Hi Claude,
RandomAccessFile wants binary data, not text data. That means readChar() expects 2 bytes, the size of a
Java char. But in an ASCII txt file, each char is just one byte. The ? is a placeholder for the two-byte Unicode character 0x646B that RandomAccessFile thinks it sees in your data. You really want to read the two separate bytes 0x64 (d) and 0x6B (k).
Anyway, RandomAccessFile is virtually never appropriate for text files. If you absolutely know that the file is broken into records all exactly the same number of bytes long, then you could use it, but by reading bytes instead of characters.
It's better to use, e.g., BufferedReader to read text files.