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
Can vector have duplicates in java?
What is a short in java?
Is stringwriter thread safe?
Is an empty arraylist null?
How can we make string upper case or lower case?
How are java objects passed to a method and what are native methods?
What is the main method java?
What is nan inf?
What is meant by nested loop?
What is numel matlab?
What is the inheritance?
What is immutable in java?
What is sizeof () operator?
What is the purpose of java?
What is java full form?