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 does readByte method in FormattedMemoryInput return?

  1. A character

  2. An integer

  3. A boolean

  4. A byte

The correct answer is: A byte

The readByte method in FormattedMemoryInput returns a single byte of data from the input stream. This is different from a character (A) as a byte is a unit of data measurement while a character is a symbol from a set of symbols used to represent things like letters and numbers. An integer (B) is also a unit of data measurement, but it is typically larger than a byte and used to represent whole numbers. A boolean (C) is a data type with a value of either true or false and is not relevant to the readByte method. Therefore, the correct answer is D A byte.