In this chapter, I have introduced the facilities for inputting and outputting basic types of data to a stream. The important points I have discussed include the following:
A stream is an abstract representation of a source of serial input or a destination for serial output.
The classes supporting stream operations are contained in the package java.io.
Two kinds of stream operations are supported: binary stream operations will result in streams that contain bytes, and character stream operations are for streams that contain characters in the local machine character encoding.
No conversion occurs when characters are written to, or read from, a byte stream. Characters are converted from Unicode to the local machine representation of characters when a character stream is written.
Byte streams are represented by subclasses of the classes InputStream and OutputStream.
Character stream operations are provided by subclasses of the Reader and Writer classes.
The printf() method that is defined in the PrintStream and PrintWriter classes formats an arbitrary number of argument values according to a format string that you supply. You can use this method for the System.out object to produce formatted output to the command line.
The static format() method that is defined in the String class will format an arbitrary number of argument values according to a format string that you supply and return the result as a String object. This method works in essentially the same way as the printf() ...