Answer Posted / tapan k dinda
To make class immutable you need to follow steps below:-
1. class should be final(strong Immutability) or all
methods final(weak Immutability)
2. all fields should be private
3. no setter/mutator should be provided
4. make deep copies of mutable data, if any
any confusion plz mention in your next post.
| Is This Answer Correct ? | 10 Yes | 2 No |
Post New Answer View All Answers
What is == mean?
How does a for loop work?
What is size_t?
Where are the card layouts used?
How to sort elements in a parallel array in java?
Can inner class have constructor?
How will you reverse a link list without using recursion?
placement papaers of spring computing technology
What are benefits of java?
Why are parameters used in functions?
What is meant by singleton class?
What do you mean by boolean?
What are the elements of java?
What does it mean that strings are immutable?
What are the three parts of a lambda expression?