I was learning java fileoperations, and I was trying to read nth byte as character in a text file. I used RandomAccessFile (I am not sure if this is the right module to use here), and my code is
import java.io.RandomAccessFile;
public class testclass {
public static void main(String[] args) throws IOException {
RandomAccessFile f = new RandomAccessFile("temptext.txt", "r");
f.seek(200);
System.out.println(f.readChar());
}
}
This is printing some unknown characters, which is not mentioned in the text file. What am I doing wrong here? My final aim is to reverse the entire text in the text file using a forloop, if I can get this right.