In java, there are three streams, which are called as the standard I/O streams. Standard I/O streams include:
The System class provides methods for using various system-related information. System.in refers to the keyboard input; System.out writes output to the monitor; System.err is used for writing error messages.
All these streams are created and opened by default. System.in is InputStream reference; System.out and System.err are declared to be of type PrintStream. PrintStream is used with byte streams. Using print and println methods of the PrintStream with System.out, you can get an output by converting objects and numbers into text.
//A simple program showing the standard input output
public class simpleIO
public static void main (String args) throws IOException
System.out.println("Please enter an alphabet: ");
value = System.in.read();
character = (char) value;
System.out.println("You entered the lowercase: " + letter);
In the above code,
In this case, System.out.println will print the output to output.txt, but System.out.err will print to the console; thus making sure all the error messages and warnings are displayed on the screen.