1. Standard input/output stream
Two member variables in the system class:
public static final InputStream in: "Standard" input stream.
public static final PrintStream out: "standard" output stream.
Note:
InputStream is = system.in;
PrintStream PS = System.out;
code example:
1 Packagecn.itcast_04;2 3 ImportJava.io.PrintStream;4 5 /*6 * Standard input/output stream7 * Two member variables in the System class:8 * public static final InputStream in "standard" input stream. 9 * public static final PrintStream out "standard" output stream. Ten * One * InputStream is = system.in; A * PrintStream PS = System.out; - */ - Public classSystemoutdemo { the Public Static voidMain (string[] args) { - //Here's what we know, this output statement is essentially an IO stream operation that outputs data to the console . -System.out.println ("HelloWorld"); - + //get standard output stream object -PrintStream PS =System.out; +Ps.println ("HelloWorld"); A at ps.println (); - //ps.print ();//This method does not exist - - //System.out.println (); - //System.out.print (); - } in}
Java Fundamentals Hardening IO Stream Note 61: The nature of the standard input and output stream