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

How do you do a line break in java?

1080


Can I learn java in 3 months?

1076


How static variable work in java?

1186


How to store image in arraylist in java?

1020


What is the properties class in java programming?

1052


What does the three dot emoji mean?

1198


Draw a UML class diagram for the code fragment given below: public class StringApplet extends Applet { private Label sampleString; private Button showTheString; private ButtonHandler bHandler; private FlowLayout layout; public StringApplet() { sampleString = new Label(" "); showTheString = new Button (" Show the String"); bHandler = new ButtonHandler(); layout = new FlowLayout(); showTheString.addActionListener(bHandler); setLayout(layout); add(sampleString); add(showTheString); } class ButtonHandler implements ActionListener { public void actionPerformed(ActionEvent e) { samplestring.setText("Good Morning"); } } } Note: The methods need not be indicated on the diagram.

2096


Can a lock be acquired on a class in java programming?

1043


Define linked list and its features with signature?

1047


Which are different kinds of source code?

1164


what is collatration?

3324


How to do a true java ping from windows?

1235


How to do encapsulation in java?

1102


What is a concrete classes? Is Java object class is concrete class?

1026


What invokes a thread's run() method in java programming?

1270