Most programs use data in one form or another, whether it is as input, output, or both.
The sources of input and output can vary between a local file, a socket on the network, a database, in memory, or another program. Even the type of data can vary between objects, characters, multimedia, and more. Java provides APIs for reading and writing streams of data. However, input and output streams are the backbone of the Java APIs and understanding them is not only crucial but can also makes programming with them a lot of fun. Overview To bring data into a program, a Java program opens a stream to a data source such as a file or remote socket, and reads the information serially.