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

Why does java doesnt suuport unsigned values?

2216


What is the difference between array and array list in java?

1211


What happens if we don’t define serial version uid?

1018


What are variable arguments or varargs?

991


How many types of memory areas are allocated by JVM in java?

1061


How do you sort arrays in java?

914


Hi Anyone know the model / questions of the Federal bank sample questions for the post of Specialist Officers - Programmers. Please post if anyone have..

2288


Why is boolean important?

1049


What is a container in a gui?

970


what is the difference between the methods sleep() and wait()? : Java thread

952


What is anagram of a string?

935


What data type is a string?

994


Is void a data type in java?

972


What flag up means?

1020


What is character in data type?

951