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

How to make a class immutable?

Answer Posted / tapan k dinda

To make class immutable you need to follow steps below:-
1. class should be final(strong Immutability) or all
methods final(weak Immutability)
2. all fields should be private
3. no setter/mutator should be provided
4. make deep copies of mutable data, if any

any confusion plz mention in your next post.

Is This Answer Correct ?    10 Yes 2 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is == mean?

934


How does a for loop work?

942


What is size_t?

934


Where are the card layouts used?

1024


How to sort elements in a parallel array in java?

841


Can inner class have constructor?

987


How will you reverse a link list without using recursion?

985


placement papaers of spring computing technology

1361


What are benefits of java?

1004


Why are parameters used in functions?

940


What is meant by singleton class?

980


What do you mean by boolean?

1014


What are the elements of java?

967


What does it mean that strings are immutable?

1074


What are the three parts of a lambda expression?

945