What’s Going On?
a. What is the name of the file created by the following program?
b. Describe the information stored at the beginning of the file (data type, purpose of the data, value of the data).
c. Describe the information stored in the remainder of the file.
import java.io.*; public class FileWriter { public static void main(String[] args) { try { long fillerPos = 0; int filler = 1000; RandomAccessFile f = new RandomAccessFile("mystery", "rw"); f.writeLong(0); f.writeChars("RalphlikesJava"); fillerPos = f.getFilePointer(); f.writeInt(filler); f.writeChars("ShailikesCoffee"); f.seek(0); f.writeDouble(fillerPos); f.close(); } catch (FileNotFoundException e) { System.err.println("File not Found " + e); } catch (IOException e) { System.err.println("Write Error: " + e); } } }
We need at least 10 more requests to produce the solution.
0 / 10 have requested this problem solution
The more requests, the faster the answer.