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

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

Dive into the depths of Java with our quiz based on "Thinking in Java, Fourth Edition" by Bruce Eckel. Test your knowledge, solidify concepts, and prepare for certification with challenging questions and insightful feedback.

Each practice test/flash card set has 50 randomly selected questions from a bank of over 500. You'll get a new set of questions each time!

Practice this question and more.


What feature does an ArrayList have over an array?

  1. It can only store primitive types

  2. It has a fixed length

  3. It can automatically resize itself

  4. It is more memory efficient than an array

The correct answer is: It can automatically resize itself

An ArrayList has the advantage of being able to automatically resize itself while an array has a fixed length. This means that an ArrayList can grow or shrink as needed, making it more flexible and convenient for storing and managing collections of data. Option A is incorrect because an ArrayList can also store non-primitive types, such as strings or objects. Option B is incorrect because an ArrayList's length is not fixed. Option D is incorrect because an array is actually more memory efficient than an ArrayList as it does not have the overhead of automatic resizing.