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 / venkata siva reddy

1.Make the class as final.
2.Make all the properties (variables) as private and final
3.Provide only getter methods for variables.

Is This Answer Correct ?    1 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

How is treeset implemented in java?

969


What is the new line character?

1123


What is meant by data hiding/encapsulation?

1055


What is a flag and how does it work?

950


Can we have two methods in a class with the same name?

1003


What is a jit compiler?

1087


Convert Binary tree to linked list.

1024


What is the purpose of using break in each case of switch statement?

977


Give me some null interfaces in java?

1016


How many wrapper classes are there in java?

978


What exactly is methodology?

867


What is protected access modifier?

963


How we can execute any code even before main method?

1092


What is externalizable?

1024


What is the purpose of a volatile variable?

987