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

How do you declare a variable?

1079


What are the two basic ways in which classes that can be run as threads may be defined?

1061


What is the difference between member variables initialization and assignment in a constructor?

1242


What are green threads in java?

989


What interface is extended by awt event listeners?

1048


how do I create a runnable with inheritance? : Java thread

965


Can I declare class as static or private?

944


What is difference between adapter class and listener?

1016


Explain inheritance in java?

968


Why pointers are not used in java?

1109


What is a container in a gui?

970


How do you add an element to a set in java?

1014


Can inner class have constructor?

1025


What is merge sort in java?

952


What is the syntax and characteristics of a lambda expression? Explain

1035