What is the result of `HashSet.toArray(new Integer[0])`?

  1. Integer array with all elements
  2. Compilation error
  3. ArrayIndexOutOfBoundsException
  4. null
Correct answer Integer array with all elements

Explanation

The `toArray()` method fills the provided array or creates a new one if needed.

Update: Admin added a tag on this question

Topics

By Admin · · 25 views