This week's book giveaway is in the Clojure forum.
We're giving away four copies of Clojure in Action and have Amit Rathore and Francis Avila on-line!
See this thread for details.
Win a copy of Clojure in Action this week in the Clojure forum!
    Bookmark Topic Watch Topic
  • New Topic

Why is String class immutable?

 
Ritesh raushan
Ranch Hand
Posts: 100
  • 0
  • Mark post as helpful
  • send pies
  • Report post to moderator
Why String class is final and immutable..what purpose about it.......thanks
 
Matthew Brown
Bartender
Posts: 4549
8
Java Netbeans IDE Scala
  • 1
  • Mark post as helpful
  • send pies
  • Report post to moderator
A lot of people seem to have been asking that question recently. Here's one of the recent threads: http://www.coderanch.com/t/590716/java/java/Why-String-class-immutable
 
Enkita mody
Ranch Hand
Posts: 333
Firefox Browser Java Windows XP
  • 0
  • Mark post as helpful
  • send pies
  • Report post to moderator
When an author doesn't want that anyone extend his class, he makes it final and if you dislike immutability of String class then go for StringBuilder or StringBuffer for mutability.

-hth
 
Ritesh raushan
Ranch Hand
Posts: 100
  • 0
  • Mark post as helpful
  • send pies
  • Report post to moderator
ankita modi. wrote:When an author doesn't want that anyone extend his class, he makes it final and if you dislike immutability of String class then go for StringBuilder or StringBuffer for mutability.

-hth



please read my Query........
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64192
83
IntelliJ IDE Java jQuery Mac Mac OS X
  • 0
  • Mark post as helpful
  • send pies
  • Report post to moderator
Please continue any discussion in one of the already existing topics on this subject.
 
I agree. Here's the link: http://aspose.com/file-tools
    Bookmark Topic Watch Topic
  • New Topic