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
Does java set allow duplicates?
How does queue work in java?
How do you classify Dialog Box?
What is stored procedure. How do you create stored procedure ?
Why string is immutable or final in java
We are seeing so many videos/audios as many web sited. But question is these videos or audios are stored in Databases ( Oracle, Mysql, Sybase,... ) or stored any file directory from there they will give the link for that? Pls explain and give sample code to achieve this one? Thanks, Seenu.
What is java util concurrentmodificationexception?
What is meant by class and object in java?
What is the use of a conditional inclusion statement in Java ?
how to one war file class to another war file class?
What is return in java?
What is the maximum size of list in java?
How many digits can a float hold?
What are identifiers in java?
Are variables stored in ram?