0% found this document useful (0 votes)
4 views2 pages

Java I - O

Java I/O (Input and Output) is essential for processing input and producing output, utilizing streams for efficient operations. The java.io package provides classes for file handling, with three automatic streams for console interaction: standard output, input, and error. Streams are classified into byte streams for byte data and character streams for character data, derived from respective base classes.

Uploaded by

Kakoli
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
4 views2 pages

Java I - O

Java I/O (Input and Output) is essential for processing input and producing output, utilizing streams for efficient operations. The java.io package provides classes for file handling, with three automatic streams for console interaction: standard output, input, and error. Streams are classified into byte streams for byte data and character streams for character data, derived from respective base classes.

Uploaded by

Kakoli
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

Java I/O

Java I/O (Input and Output) is used to process the input and produce the output.

Java uses the concept of a stream to make I/O operation fast. The [Link]
package contains all the classes required for input and output operations.

We can perform file handling in Java by Java I/O API.

Stream

A stream is a sequence of data. In Java, a stream is composed of bytes. It's


called a stream because it is like a stream of water that continues to flow.

In Java, 3 streams are created for us automatically. All these streams are
attached with the console.

1) [Link]: standard output stream

2) [Link]: standard input stream

3) [Link]: standard error stream

An input stream is used to read data from the source. And, an output stream is
used to write data to the destination.

Types of Streams

Depending upon the data a stream holds, it can be classified into:

● Byte Stream
● Character Stream

Byte Stream

Byte stream is used to read and write a single byte (8 bits) of data.

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

Character Stream
Character stream is used to read and write a single character of data.

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

You might also like