How can a Variable in a class other than String type be made Immutable.

Showing Answers 1 - 2 of 2 Answers

Ramesh Mandaleeka

  • Oct 18th, 2005
 

Provide a constructor to initilize the variable and remove the mutator method ( setter method) for that variable.

  Was this answer useful?  Yes

sandhya

  • Apr 16th, 2007
 


   Hi !

     To make a variable immutable declare the variable as final  so that the values cannot be changed .

  Was this answer useful?  Yes

Give your answer:

If you think the above answer is not correct, Please select a reason and add your answer below.

 

Related Answered Questions

 

Related Open Questions