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

Tell me a few examples of final classes defined in Java API?

0 Answers   DELL,


What are runtime exceptions?

0 Answers  


How do generics work in java?

0 Answers  


What is oop principle in java?

0 Answers  


What is jit and its use?

0 Answers  






Write a program to reverse a number in java?

0 Answers  


What happens if I remove static from main method?

0 Answers  


Is main an identifier?

0 Answers  


How do you start a thread?

0 Answers  


How to overcome the exception object reference not set to an instance of object?

0 Answers   Wipro,


What is the maximum size of a string in java?

0 Answers  


Catch(Exception e){ } in that what is Exception and purpose of that in that place exactly?

3 Answers  


Categories