This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes Java in General and the fly likes Why String is immutable in Java? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » Java in General
Bookmark "Why String is immutable in Java?" Watch "Why String is immutable in Java?" New topic
Author

Why String is immutable in Java?

Rd Dari
Ranch Hand

Joined: Feb 22, 2010
Posts: 206

Hi all,

Please clear why String is immutable in java with a understandable example?


Thanks !!
Jaikiran Pai
Marshal

Joined: Jul 20, 2005
Posts: 9956
    
163

See previous discussions

[My Blog] [JavaRanch Journal]
Satyaprakash Joshii
Ranch Hand

Joined: Jun 18, 2012
Posts: 131
one reason is..immutable objects are simple...less error prone...once created cant be changed and if multiple threads are accesing at same time still it doesnt cause any issue...
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Why String is immutable in Java?
 
Similar Threads
why string
why immutable string object ?
Why String in Java is made immutable?
Strings
Immutable classes in java