This week's book giveaway is in the Python forum.
We're giving away four copies of Python Continuous Integration and Delivery and have Moritz Lenz on-line!
See this thread for details.
Win a copy of Python Continuous Integration and Delivery this week in the Python forum!
    Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Bear Bibeault
  • Paul Clapham
  • Jeanne Boyarsky
Sheriffs:
  • Devaka Cooray
  • Junilu Lacar
  • Tim Cooke
Saloon Keepers:
  • Tim Moores
  • Ron McLeod
  • Tim Holloway
  • Claude Moore
  • Stephan van Hulst
Bartenders:
  • Winston Gutkowski
  • Carey Brown
  • Frits Walraven

Why is String class immutable?  RSS feed

 
Ranch Hand
Posts: 101
  • Mark post as helpful
  • send pies
  • Report post to moderator
Why String class is final and immutable..what purpose about it.......thanks
 
Bartender
Posts: 4568
9
  • Likes 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
 
Ranch Hand
Posts: 333
Firefox Browser Java Windows XP
  • 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: 101
  • 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........
 
Marshal
Posts: 67240
170
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Report post to moderator
Please continue any discussion in one of the already existing topics on this subject.
 
That's my roommate. He's kinda weird, but he always pays his half of the rent. And he gave me this tiny ad:
Become a Java guru with IntelliJ IDEA
https://www.jetbrains.com/idea/
    Bookmark Topic Watch Topic
  • New Topic
Boost this thread!