Which of the following is true about DataInputStream and BufferedInputStreamA. DataInputStream is a subclass of BufferedInputStreamB. BufferedInputStream is a subclass of DataInputStreamC. DataInputStream can be chained to BufferedInputStream to provide formatteddata inputD. BufferedInputStream can be chained to DataInputStream to provide buffering
Question
Which of the following is true about DataInputStream and BufferedInputStreamA. DataInputStream is a subclass of BufferedInputStreamB. BufferedInputStream is a subclass of DataInputStreamC. DataInputStream can be chained to BufferedInputStream to provide formatteddata inputD. BufferedInputStream can be chained to DataInputStream to provide buffering
Solution
C. DataInputStream can be chained to BufferedInputStream to provide formatted data input.
This is true because in Java, you can chain a DataInputStream to a BufferedInputStream to read primitive data types from an input stream in a portable way. The BufferedInputStream adds functionality to another input stream-namely, the ability to buffer the input and to support the mark and reset methods.
Options A and B are incorrect because DataInputStream and BufferedInputStream are both subclasses of FilterInputStream, not of each other.
Option D is also incorrect because while you can technically chain a BufferedInputStream to a DataInputStream, it wouldn't provide buffering. The buffering should be added to the underlying input stream before wrapping it with a DataInputStream for reading primitive data types.
Similar Questions
Which of the following is true about FileInputStream and FileOutputStreamA. FileInputStream is a subclass of FileOutputStreamB. FileOutputStream is a subclass of FileInputStreamC. FileInputStream and FileOutputStream can be chained together to provide rawdata input and output to a fileD. FileInputStream and FileOutputStream can not be chained togethe
What is the purpose of the DataInputStream class in Java?Question 4Answera.To read primitive data types from a fileb.To read text from a character-based input streamc.To read serialized objects from a filed.To read binary data from a file
What is the purpose of the BufferedOutputStream class in Java?Question 6Answera.Reading binary datab.Writing binary datac.Reading character datad.Writing character data
Which of these class is not related to input and output stream in terms of functioning?
Which stream class is used to write formatted text to a file in Java?Question 13Answera.PrintWriterb.FileWriterc.FileOutputStreamd.BufferedWriter
Upgrade your grade with Knowee
Get personalized homework help. Review tough concepts in more detail, or go deeper into your topic by exploring other relevant questions.