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 create packages in java?

0 Answers  


How will you calculate the depth of a binary tree if the tree contains 15 nodes?

0 Answers   Aricent,


What is a numeric digit?

0 Answers  


What is toarray method in java?

0 Answers  


Where is jre installed?

0 Answers  


What do you mean by hashing?

0 Answers   Amazon,


What is a singleton class in Java? And How to implement a singleton class?

2 Answers  


Can we override constructor?

0 Answers  


What is the reason behind using constructors and destructors?

0 Answers   HCL,


What is deserialization?

0 Answers  


What do you mean by scope of variable?

0 Answers  


What language is pass by reference?

0 Answers  


Categories