Using System class you can work with 3 different types of streams to read or print data
System.in : Standard Input Stream - open and ready to supply input data
System.out : Stand Output Stream - open and ready to accept output data
System.err : Stand Error Stream - open and ready to accept output data
Generally output stream may be set with any output device or file. Based on the stream which are using the output will be redirected to the corresponding stream.
Here in your program you are printing the data using "System.out" - nothing but standard output stream so what ever the output come through your program will be redirected to the default output device.
Input streams are used to read the data. For example, assume that you want to read the data from the keyboard then you can read like the below
Scanner scanner = new Scanner(System.in);