The System class in java.lang provides the "standard" IO streams System.in, System.out, and System.err. |
System.in is an instance of InputStream. |
System.out and System.err are instances of PrintStream. |
PrintStream is a subclass of FilterOutputStream, which itself is a subclass of OutputStream. (See next foil.) PrintStream objects should not be instantiated; use other subclasses of FilterOutputStream for byte streams or PrintWriter objects for character streams. |
PrintStream and PrintWriter define methods print(...) and println(...), which output any primitive type: |
System.out.println( "Enter character: " ); |
int ch = System.in.read(); |
System.out.println( (char) ch ); |