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 are Java source code files named?

3 Answers  


what is the difference between System.exit() and System.exit(1)?

1 Answers   eClinical Solutions, eClinical Works, eClinicalWorks,


Write program to print Hello World and print each character address in that string and print how many times each character is in that string? Ex: H: 0 & 1 e:1 & 1 l :2,3,8 & 3 o:4,6 & 2 w:5 & 1 r: 7 & 1 d 9 & 1

7 Answers   Huawei, IBM,


Why is java so important?

0 Answers  


What is the functionality of Webserver?

2 Answers  


What does three dots mean in java?

0 Answers  


which one the better thread emplemented thread or extended ?

4 Answers   Fidelity,


What does math floor () do?

0 Answers  


Explain about interrupt() method of thread class ?

0 Answers  


Why static functions are used?

0 Answers  


What is immutable state?

0 Answers  


Is null a string?

0 Answers  


Categories