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
What is private public protected in java?
What are constructors in java?
Why does the integer quotient -0/3 yield 0, but the double quotient -0.0/3.0 yields – 0.0?
Can you start a thread twice in Java?
What is thread pool in java with example?
What is the difference between char and char *?
What is the difference between JDK and JVM?
Can we override final method?
What is ctrl m character?
What does 3 dots mean in java?
What are the main uses of this keyword?
What is the full name of java?
What is use of valueof () in java?
how would you implement a thread pool? : Java thread
Explain super keyword in java.