English | 简体中文 | 繁體中文 | Русский язык | Français | Español | Português | Deutsch | 日本語 | 한국어 | Italiano | بالعربية

Java Basic Tutorial

Java flow control

Java array

Java object-oriented (I)

Java object-oriented (II)

Java object-oriented (III)

Java Exception Handling

Java List

Java Queue (queue)

Java Map collection

Java Set collection

Java input and output (I/O)

Java Reader/Writer

Java other topics

Java I/O Stream

In this tutorial, we will learn Java input/Output stream and its types.

In Java, streams are sequences of data that are read from a source and written to a target.

OneInput streamUsed to read data from the source. And,Output streamUsed to write data to the target.

class HelloWorld {
    public static void main(String[] args) {
        System.out.println("Hello, World!"); 
    }
}

For example, in our firstHello WorldIn the example, we have used System.out to print strings. Here, System.out is an output stream.

Similarly, there are input streams that accept input.

We will learn about input streams and output streams in detail in the following tutorials.

Stream Types

According to the data contained in the stream, it can be classified as:

  • Byte Streams

  • Character Streams

Byte Streams (Byte Streams)

Byte streams are used to read and write individual bytes (8data (bit).

All byte stream classes are derived from the basic abstract classes called InputStream and OutputStream.

For more information, please visit

Character Streams (Character Streams)

Character streams are used to read and write individual data characters.

All character stream classes are derived from the basic abstract class Reader and Writer.

For more information, please visit