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
How can you handle java exceptions?
what do you mean by classloader?
How many bits are used to represent unicode, ascii, utf-16, and utf-8 characters in java programming?
Explain a situation where finally block will not be executed?
Is string a class?
What is struts in java?
What is meant by inheritance and what are its advantages?
Can you write a java class that could be used both as an applet as well as an application?
what are synchronized methods and synchronized statements? : Java thread
Why does java have different data types for integers and floating-point values?
What are void pointers?
What language is java written?
What is the dot operator?
What is jit compiler ?
Is alive and join method in java?