adspace


How do you make a class immutable in java?

Answer Posted / Ravi Ranjan

To make a class immutable in Java, make its fields final (to ensure they cannot be modified), ensure the constructor is private, and provide factory methods for creating instances.

Is This Answer Correct ?    0 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

i want test pattern of zylog company and some examples also

2869