Question PRG-JAVA-0074
HardWhy does Java's String.hashCode() cache its value?
- A.
Strings are immutable, so the hash never changes and computing it once saves time
- B.
To save memory
- C.
Sign up free to see the answer and a step-by-step explanation.
Popular companies
Prepare company by company
Hiring pattern, syllabus, past questions and mocks for each company.
All companiesPractice by subject
Java question
Why does Java's String.hashCode() cache its value?
Strings are immutable, so the hash never changes and computing it once saves time
To save memory
Sign up free to see the answer and a step-by-step explanation.
Because it is random
It doesn't