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

What is immutable class? how to make a Class explicitly
"Immutable"?Wap to make a class explicitly immutable.

Answer Posted / rv.nandakishore

I think u know... String is not a data type.. it is a
class...right..

By default the String class is a immutable class. That means
once we instantiate the object or assigning the value to
String is immutable. Once we can assign / instantiate the
String class we can't change in the future....


class StringDemo
{
public static void main(String[] args)
{
String s1="Nanda";
String s2="Kishore";
String s3=new String("Nanda Kishore");
System.out.println(s1);
System.out.println(s2);
System.out.println(s3);
}
}



U try any changes anything and print s1,s2 & s3.... If
changes then it is not immutable. If not it is immutable.


Is This Answer Correct ?    2 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

How do you join strings in java?

1031


Can an integer be a string?

1038


What is the different between get and post?

953


Why vector is used in java?

1012


What are jee technologies?

990


What is stack explain?

979


Explain about java sdk?

1022


What is vector capacity in java?

1066


What is string manipulation?

986


What is package private scope in java?

929


Can we convert integer to string in java?

1038


How objects are stored in java?

1019


what is difference between equals and ==?

1042


What is the difference between a method and a function in alice?

1171


What is meant by class?

985