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...

String is a immutable objects . it means that string does
not change...........
But it will be chang.........
{
String s="kapil";
String s1="raj";
String s=s1;
then print(.......)
The String has been changed ..
how it is possible and why its called immutable objects

Answer Posted / christine

Immutable means if you apply any methods to a String, it
would not affect the original String you created.
For eg,

String s = "test";
s.concat(" two");
System.out.println(s);

The output is still "test" and not "test two";
Java pass by reference. If you use = to assign the string
to another string, then the reference would change.
Therefore your example changes the string.

Is This Answer Correct ?    1 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Is string a class in java?

977


What happens if I remove static from main method?

1004


Implementations of set interface?

1006


What is wrapper class html?

935


Is java developer a good career?

1016


What Is Query Throttling in java?

997


What are register variables what are the advantages?

899


How to run a JAR file through command prompt?

1274


Is java ee a framework?

979


What is the difference between throw and throws keywords?

1050


How objects of a class are created if no constructor is defined in the class?

1064


What is immutability in java?

1073


Explain the difference between call by refrence and call by value?

1018


What’s the difference between constructors and other methods?

989


java program with complete 4 oops concepts implemented example

3154