Skip to content
Sharp

Collections · interview question

Which method can you use to check if an ArrayList is empty?

Multiple choiceEasychapter-4-curatedpremiumcollectionslist-interface-and-arraylist
Choose one answer
Answer and explanation

Correct answer

D. IsEmpty()

Why

The isEmpty() method returns true if the ArrayList contains no elements, which is a straightforward way to check for emptiness.

Test yourself on Collections

A free test with instant, explained results. No account needed.

Start free test
All Collections questions →