Can a value from an int variable
be written to a binary file without first translating it into characters?
Answer:
Yes.
OutputStream
A Java int uses patterns of 32 bits to represent integers.
The exact pattern contained in an int can be written to four bytes
of a binary file.
OutputStream is an abstract class from which all byte-oriented output streams descend. Its descendant classes are used for general-purpose (non-character output). These streams write groups of bytes to output destinations. Java writes the same format for primitive types on all computer systems. The data in a binary file can be read by Java programs running on any computer system.
A FileOuputStream connects an output stream of bytes to a file. It is has methods for writing single bytes or an array of bytes to a file, and some other methods. These methods are not very useful for us since you have to deal with the individual bytes of a data type.
A DataOuputStream can be connected
to a FileOutputStream to provide
methods that are convenient for writing various data types to a file.
QUESTION 3:
Do you suppose that FileOutputStream provides a way to write an int?