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 class immutable

Answer Posted / vijayakumar chinnasamy

Steps:
1. Create class as final class
2. Make all the properties i.e instance variable as final.
3. Avoid or make the least access for the setter method
for properties.

Is This Answer Correct ?    2 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is an i/o filter?

1810


Is jdk required on each machine to run a java program?

1285


why would you use a synchronized block vs. Synchronized method? : Java thread

948


How do you end a program?

1114


What is entry in java?

1032


How many digits can a float hold?

1011


When throws keyword is used?

998


How can you set an applet’s height and width as a percentage?

928


Can I import same package/class twice?

952


How do I find and replace in word?

978


What are the 6 boolean operators?

1098


How do you sort an array in java?

990


What is meant by 'bit masking' in java?

1186


Can you use this() and super() both in a constructor?

981


Explain the difference between intermediate and terminal operations in java8?

1111