Answer Posted / rashmin
To make a class immutable follow the below steips
1. Make the class Final.
2. Make the instance variables private and final.
3. Make the methods in the class also final.
By doing the above 3 we can create a fully immutable class.
| Is This Answer Correct ? | 4 Yes | 6 No |
Post New Answer View All Answers
What is an argument in java?
What is the original name of java?
What is regex used for?
What is a super method?
Which is faster call by value or call by reference?
Give me an example of array and linked list? Where they can be used?
What is java util hashmap?
How does java pattern compile work?
What is Java Annotations?
What is the map interface in java programming?
What is compiler and what its output.
What Is Composition?
What is a for loop in java?
Is java a software?
Is hashset sorted in java?