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