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.


Why is RandomAccessFile not part of the InputStream or OutputStream hierarchies?

  1. Because it allows seeking within a file

  2. Because it operates on text files only

  3. Because it was added in a later Java version

  4. Because it does not support I/O operations

The correct answer is: Because it allows seeking within a file

RandomAccessFile is not part of the InputStream or OutputStream hierarchies because it allows for random access or seeking within a file, meaning it can read or write at any position within a file. This feature is not supported by the other options provided, which either operate on text files only (B), were added in a later Java version (C), or do not support I/O operations (D).