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
What is a nullable field?
How do you do math powers in java?
How many bytes is string in java?
What are measurable parameters?
What is the symbol for average?
What about instanceof operator in java?
What are the advantages of arraylist over arrays?
How to convert string to char and vice versa?
What is a parameter in simple terms?
What is the latest version of java?
Can we sort hashmap in java?
Is java an open source?
Suppose if we have variable ' I ' in run method, if I can create one or more thread each thread will occupy a separate copy or same variable will be shared?
Can we have more than one package statement in source file ?
When a byte datatype is used?