Java I/O Interview Questions and Answers
What is meant by Stream and what are the types of Streams and classes of the Streams?
A Stream is an abstraction that either produces or consumes information.
There are two types of Streams. They are:
- Byte Streams : Byte Streams provide a convenient means for handling input and output of bytes.
- Character Streams : Character Streams provide a convenient means for handling input and output of characters.
- Byte Stream classes : Byte Streams are defined by using two abstract classes. They are:InputStream and OutputStream.
- Character Stream classes :Character Streams are defined by using two abstract classes. They are : Reader and Writer.
What is the difference between the Reader/Writer class hierarchy and theInputStream/OutputStream class hierarchy?
The Reader/Writer class hierarchy is character-oriented and the InputStream/OutputStream class hierarchy is byte-oriented.
What is the purpose of the File class?
The File class is used to create objects that provide access to the files and directories of a local file system.
What is an I/O filter?
An I/O filter is an object that reads from one stream and writes to another, usually altering the data in some way as it is passed from one stream to another.
What class allows you to read objects directly from a stream?
The ObjectInputStream class supports the reading of objects from input streams.