Same as Before

Classic programmed-learning exercises, refreshed for modern Java and presented in the current MrStyner.com portfolio style.

Modern Java noteThis archive has been refreshed for Java 25 LTS. Core language concepts remain useful, while outdated setup instructions and browser-era Java are labeled or replaced. Java 26 is the current feature release; Java 25 is used here as the stable teaching baseline.
go to previous page   go to home page   go to next page        

Answer:

The same as before.

Same as Before

A dump of the new file is indistinguishable from that of the previous file. A program that reads data from this file must be written with the knowledge of how the file was written. (Of course, since I know how it was written the brackets under the bytes show the intended groupings).

Here is an excerpt from the DataOutputStream documentation.

public void writeBytes(String s) throws IOException
    Writes the low eight bits of each character in the string.

This does not write the String object to the stream, but writes bytes based on the characters held in the String. A String object (like all objects) is a discrete entity with its own data, methods, and internal organization. The writeBytes() just writes out the characters. If the characters in a String are from the usual Western alphabet, the writeBytes() method writes normal 8-bit ASCII.

QUESTION 16:

How is this different from a Writer stream?