Ask a Question
x

Choose Country Code

x

Direction

x

Ask a Question

  • Ask a Question
  • Scan a Question
  • Post MCQ
  • Note: File extension must be of jpg, jpeg, png, bmp format and file size must not exceed 5 MB
x

Ask a Question

x

Hire a Tutor

Answers and Solutions

What's Your Question?
Answer

As String class is final, it is immutable. Hence it is thread safe. Also, due to its immutability property, string is mostly used as key in the collection such as HashMap. Main advantage of using String as key is that once the hashcode is calculated, due to its immutability, no need to calculate the hashcode again. Hence "caching" of the hashcode takes place here.

Post Answer and Earn Credit Points

Get 5 credit points for each correct answer. The best one gets 25 in all.

Post Answer