Why are strings immutable in Java?

Answer Posted / 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       View All Answers


Please Help Members By Posting Answers For Below Questions

Does java support multiple inheritances?

565


Explain the concept of hashtables?

625


How many threads can java run?

567


Can a class be a super class and a sub-class at the same time? Give example.

818


What is tochararray in java?

511






What are access specifiers in java ?

599


What are the actions that can occur when a thread enters blocked state?

591


What is sizeof () operator?

578


What is a marker interface?

582


How is abstraction implemented in java ?

550


In the below example, how many string objects are created?

567


What is hashing in java?

579


What are static initalizers in java ?

590


What is runtime locatable code?

879


What is a platform?

551