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 / anil kumar khichar

Immutable means the original String never get changed or
replaced by another one. You can simply concate another one
, but beware you can't replace it. Look at the following:-


{
String s="kapil";
String s1="raj";
String s=s1;

see here if you assign s1 to s ,there will you get error.
And it's not allowed here. So we can say Strings are immutable.

Thanks!
Anil

Is This Answer Correct ?    1 Yes 4 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is a java applet? What is an interface?

1096


Why singleton pattern is better than creating singleton class with static instance?

996


What are the advantages and disadvantages of reference counting in garbage collection?

1028


extending thread class or implementing runnable interface. Which is better? : Java thread

997


Why do we use string?

1038


What is local class in java?

1087


what happens when a thread cannot acquire a lock on an object? : Java thread

1049


Why java applets are more useful for intranets as compared to internet?

1077


Can final class have constructor?

922


Is java util regex pattern thread safe?

1017


Why is the main method static?

1156


Can a constructor have different name than a class name in java?

1186


Give an example of call be reference significance.

1029


What is a locale?

1145


Can we override final method?

1008