Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...

When you say String is immutable, what do you mean by that?
Say I have String s = "Ness"
s= s+"Technologies";
What will happen? If the value gets appended, then what is
the meaning of immutable here?

Answer Posted / haribabu

Once you have assigned a value to a "String Object" (i am
saying an "object" not the "object reference")that value
can never change. This is immutability.

by defining "s = s+Technologies" we are pointing the
REFERENCE to newly created "string object" with the
modified string. So the previous string object is
considered to be lost.

This concept has explained very well in String, I/Os
chapter of Kethy Siera, SCJP 5.

All the best

Is This Answer Correct ?    26 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

How will you add panel to a frame?

1163


What is the purpose of the wait(), notify(), and notifyall() methods in java programming?

1137


What is string made of?

1013


Will the jvm load the package twice at runtime?

1147


What does a za z0 9 mean?

1183


What is return used for in java?

1063


What is the purpose of nested class in java?

1135


How can we break singleton in java?

1014


What is the difference between multitasking and multithreading in Java

1232


What is widening and narrowing in java? Discuss with an example.

1100


What is logical variable?

1038


How many ways can we create singleton class?

1019


What do you mean by Function Overloading in java?

1218


Garbage collection in java?

1065


How do I stop concurrentmodificationexception?

1078