What will be the initial capacity of a HashSet when no size is defined during its creation?
- 0
- 10
- 16
- It will result in an error
When you create a HashSet in Java without specifying its initial capacity, it defaults to an initial capacity of 16. The capacity dynamically increases as needed when elements are added to the HashSet.
Loading...
Related Quiz
- ________ allows you to traverse the collection, access the element, and insert
- The keyword ________ is used to apply restrictions on class, method, and variable.
- A variable declared as double d = 10.3; occupies ________ bytes of memory.
- Deadlock occurs when two or more threads are blocked forever, each waiting for the other to ________.
- What is the role of FileWriter and FileReader in character streams when dealing with file I/O?