Java Reference
In-Depth Information
Table 10-2 The Character Stream I/O Classes
The Predefined Streams
As you know, all Java programs automatically import the java.lang package. This package
defines a class called System , which encapsulates several aspects of the run-time environ-
ment. Among other things, it contains three predefined stream variables, called in , out , and
err . These fields are declared as public , final , and static within System . This means that
they can be used by any other part of your program and without reference to a specific Sys-
tem object.
System.out refers to the standard output stream. By default, this is the console. Sys-
tem.in refers to standard input, which is by default the keyboard. System.err refers to the
standard error stream, which is also the console by default. However, these streams can be
redirected to any compatible I/O device.
 
Search WWH ::




Custom Search