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 / rashmin

To make a class immutable follow the below steips

1. Make the class Final.
2. Make the instance variables private and final.
3. Make the methods in the class also final.

By doing the above 3 we can create a fully immutable class.

Is This Answer Correct ?    4 Yes 6 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What are the three parts of a lambda expression?

1008


what is the purpose of "virtual"?

1085


What are the characteristics of Final,Finally and Finalize keywords.

1173


What do you mean by stack?

1152


What programs use java?

958


What is token in java?

1015


What does exclamation mean in java?

1097


Have you ever used hashtable and dictionary?

1016


Is upper case in java?

958


Describe 2 different ways to concatenate two strings.

1199


What is the final method?

1073


What will happen when using pass by reference in java?

989


Explain thread life cycle in java?

1033


What is method overloading with type promotion?

1270


How do you decide when to use arraylist and linkedlist?

991