Hi,
This is from one of the mock tests.
The answer is b. The explanation given to this is....
The number 7890 is stored at file location 5 since the previously written boolean & int values occupy 5 bytes.
Can anyone explain me the output ?
Import java.io.* ;
class Test{
public static void main(
String args[]) throws IOException {
RandomAccessFile f = new RandomAccessFile("test.txt","rw") ;
f.writeBoolean(true) ;
f.writeInt(123456) ;
f.writeInt(7890);
f.writeInt(777);
f.writeFloat(.0001f);
f.seek(5);
System.out.println(f.readInt()) ;
f.close();
}
}
a. 123456
b. 7890
c. 1000000
d. 777
e. .0001
Thx in advance.