Introduction:

Every computer program has exchange of data happening between two or more sources. This can be as simple as reading data from or writing data to a buffer within the same program or as seemingly complex as transferring data between two different processes running on different systems located on opposite sides of the world. Streams were created in Java to provide a consistent interface for programmers to interact with different sources if I/O in their program.

The basic idea of a stream is that data enters one end of a data channel in a particular sequence and comes out the other end in the same sequence-a first-in-first-out (FIFO) scheme.