Answer Posted / kanchan
1. Don't provide any methods that modify the object
2. Ensure that no methods may be overridden. This prevents
careless or malicious subclasses from compromising the
immutable behavior of the class. Preventing
method overrides is generally done by making the class final
3. Make all fields final.
4. Make all fields private. This prevents clients from
modifying fields directly.
| Is This Answer Correct ? | 3 Yes | 0 No |
Post New Answer View All Answers
Explain different states of a thread in java?
What is nextline method in java?
What means public static?
Can finally block be used without a catch?
What is space character in java?
What is a method vs function?
Is null a string?
Can constructor return value?
What is polymorphism java example?
What about anonymous inner classes in java?
What are "class access modifiers" in Java?
Why strings in java are called as immutable?
What is a nonetype?
Does java return by reference?
What is singletonlist in java?