wood burning stoves 2.0*
The moose likes Beginning Java and the fly likes Why is String class immutable? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Reply locked New topic
Author

Why is String class immutable?

Ritesh raushan
Ranch Hand

Joined: Aug 29, 2012
Posts: 100
Why String class is final and immutable..what purpose about it.......thanks
Matthew Brown
Bartender

Joined: Apr 06, 2010
Posts: 4343
    
    8

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

Joined: Aug 06, 2012
Posts: 333

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


OCA7
Ritesh raushan
Ranch Hand

Joined: Aug 29, 2012
Posts: 100
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

Joined: Jan 10, 2002
Posts: 60781
    
  65

Please continue any discussion in one of the already existing topics on this subject.


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Why is String class immutable?
 
Similar Threads
Tech Word Game
date format with MS Access database
ResultSet to Array
WA #1.....word association
hello...I need only help....in this question