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

What is the difference between error and an exception?

1157


What is java in simple terms?

1004


Write a program to calculate factorial in java?

1009


Which collection allows duplicate values in java?

974


Can you pass by reference in java?

982


What does n mean in java?

974


Is null a string in java?

1081


Why Set interface contains unique elements, what internally implemented for this so that it contains unique elements?

8114


How many arguments can be passed to main ()?

995


Which way a developer should use for creating thread, i.e. Sub classing thread or implementing runnable.

931


What is a functional interface?

1044


What is the meaning of flag day?

1025


Why are getters and setters used?

1062


What are JVM.JRE, J2EE, JNI?

1104


What is compareto?

1040