How many bytes does the following code write to file dest
?
1. try { 2. FileOutputStream fos = new FileOutputStream("dest"); 3. DataOutputStream dos = new DataOutputStream(fos); 4. dos.writeInt(3); 5. dos.writeDouble(0.0001); 6. dos.close(); 7. fos.close(); 8. } 9. catch (IOException e) { }
C.
The writeInt()
call writes out an int, which is 4 bytes long.
The writeDouble()
call writes out a double, which is 8 bytes long.
The total is 12 bytes.