What is a stream? what are the different types and classes
of Streams?

Answer Posted / kumar

Most of the programs work with external data stored either
in local files or coming from other computers on the
network. Java has a concept of working with so-called
streams of data. After a physical data storage is mapped to
a logical stream, a Java program reads data from this
stream serially - byte after byte, character after
character, etc. Some of the types of streams are byte
streams (InputStream, OutputStream) and character streams
(Reader and Writer). The same physical file could be read
using different types of streams, for example,
FileInputStream, or FileReader.

There are different types of data, and hence different
types of streams.

Here's the sequence of steps needed to work with a stream:
1. Open a stream that points at a specific data
source: a file, a socket, URL, etc.
2. Read or write data from/to this stream.
3. Close the stream.

Is This Answer Correct ?    1 Yes 2 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is functional interface in java?

503


What’s the difference between applets and standalone program?

517


What is the statements?

573


How do I print a “?

561


How many bytes is a string in java?

520






What is the difference between static method and instance method in Java?

553


What is procedure overloading?

1787


What is method in java ?

612


What is a treemap in java?

524


How can we find the actual size of an object on the heap?

794


Can a class extends itself in java?

523


What are keyboard events?

598


Is string a datatype?

540


What are streams?

620


What does a void function return?

535