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
Which is better stringbuilder or stringbuffer?
What is the difference in between cpp and java? Can u explain in detail?
What is meant by anonymous class?
Can a variable be local and static at the same time?
Can size_t be negative?
What is a final class ?
How can you traverse a linked list in java?
What is data type example?
What are disadvantages of java?
Is java still necessary?
Can a static method be overridden in java?
Explain the concept of proper inheritance?
What is get () in java?
Explain about join() method?
What is the difference between serializable and externalizable interfaces?