Output to standard output and standard error; and input from standard input.
import java.io.BufferedReader;
import java.io.InputStreamReader;
publicclass InputOutputDemoStandardInputOutput {
publicstaticvoid main(String[] a) throws Exception {
//Write characters to standard output and standard error:
System.out.println("std output");
System.err.println("std error");
//Read characters from standard input (the keyboard):
System.out.print("Type some characters and press Enter: ");
BufferedReader bisr = new BufferedReader(new InputStreamReader(
System.in));
String response = bisr.readLine();
System.out.println("You typed: '" + response + "'");
//Read a byte from standard input (the keyboard):
System.out.print("Type one character and press Enter: ");
byte b = (byte) System.in.read();
System.out.println("First byte of your input is: " + b);
}
}