char[] input =new char[24];
for (int i=0; i<24; i++){
input[i] = (char)('a'+i);
}
RandomAccessFile bf = new RandomAccessFile("data1.txt", "rw");
for(int i=0; i<24; i++){
bf.writeChar(input[i]);
}
With Above code, when I open the file, it seems to be "abcd..." as I expected, but when I try to read the file
RandomAccessFile rf1 = new RandomAccessFile("data1.txt", "r");
rf1.seek(0);
System.out.println(rf1.readChar());
rf1.seek(1);
System.out.println(rf1.readChar());
rf1.close();
It gives 'a' as expected but when seek(1) it gives me ? rather than b, why?