Why are strings immutable in Java?



Why are strings immutable in Java?..

Answer / hrindows@gmail.com

Strings in java are frequently used for hashmap keys. Now if someone changes the value of the string it will cause severe discrepancies. Hence strings are made immutable.

Is This Answer Correct ?    0 Yes 0 No

Post New Answer

More Core Java Interview Questions

How to change the priority of thread or how to set priority of thread?

0 Answers  


What are the main differences between notify and notifyAll in Java?

0 Answers  


What is an image buffer?

0 Answers  


Explain the purpose of garbage collection in Java?

0 Answers   BirlaSoft,


Tell me about different OOPS concepts.

0 Answers   Amdocs,






Explain how hashmap works?

0 Answers  


without using arthematic operation ,how can you write the logic for adding/substraction/multiplication?

7 Answers   Tanla Solutions, Wipro,


Can a class be declared as protected?

0 Answers  


If you are reviewing the code of your team members, what points will you look at, assuming the performance of the application is not so great

2 Answers   KPIT,


What is mean by encoding?

0 Answers  


How many JVMs can run on a single machine and what is the Just-In-Time(JIT) compiler?

0 Answers   Global Logic,


What is the major drawback of internal iteration over external iteration?

0 Answers  


Categories