Answer Posted / vishalshetkar
Since String is immutable, its hashcode is cached at the time of creation and it doesn’t need to be calculated again. This makes it a great candidate for keys in a Map and its processing is fast than other HashMap key objects. This is why String is mostly used Object as HashMap keys.
| Is This Answer Correct ? | 0 Yes | 0 No |
Post New Answer View All Answers
Explain about doubly linked list
What is a final class in java?
What is the default value of an object reference declared as an instance variable?
What is included in core java?
What are 4 pillers of object orinted programming?
How to create a fecelet view?
What loop means?
What is the purpose of the file class in java programming?
Is java a virus?
Can a class be declared as protected?
Why unicode is important?
What happens to a static var that is defined within a method of a class?
What are the benefits of immutable objects?
Why are generics used?
Can we change the scope of the overridden method in the subclass?