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 instance example?
What exactly is a .class file?
What's the base class of all exception classes?
What is the generic function?
What is abstract class constructor called?
What is the purpose of garbage collection in java? When is it used?
How to use string tokenizer class.
Explain about instanceof operator in java?
What are the three best choices for a development environment?
What about abstract classes in java?
What is singleton class and how can we make a class singleton?
How do you end a program?
How to find the largest value from the given array.
What are the main uses of this keyword?
What is the properties class in java programming?