Mastering Java: The Ultimate Quiz for 'Thinking in Java'

Disable ads (and more) with a membership for a one time $2.99 payment

Mastering Java: The Ultimate Quiz for 'Thinking in Java'. Dive deep into Java with multiple-choice questions. Challenge yourself with quiz questions designed to test and improve your understanding of the 'Thinking in Java' book. Get ready for your exam!

Practice this question and more.


What kind of stream does ByteArrayInputStream represent?

  1. Character stream

  2. Byte stream

  3. Object stream

  4. Data stream

The correct answer is: Byte stream

ByteArrayInputStream represents a byte stream because it is used to read input as a sequence of bytes. This means that it reads the data as individual elements of bytes, as opposed to the other options. Character streams are used to read text data, object streams are used to serialize and deserialize objects, and data streams are used for reading primitive data types. Therefore, B is the most suitable choice for the type of stream represented by ByteArrayInputStream.