Answer Posted / raga
While creating class objects of which will be immutable. The following
things should be kept in mind:
1. Class should be made final so that no class can extend it.
2. Access modifiers of the instance variables must be private so that no
object can have access to it.
3. There should not be any public set method which can change the state of
the object.
| Is This Answer Correct ? | 1 Yes | 0 No |
Post New Answer View All Answers
How do you remove an object from an arraylist in java?
What is the importance of static variable?
what is meant by Byte code concept in Java?
What is a constructor, constructor overloading in java?
Differentiate between stringbuffer and string?
What initialize variables?
What is the difference between state-based unit testing and interaction-based unit testing?
What is the most important feature of java? What is an interface?
What comes to mind when someone mentions a shallow copy in java?
What is finally in Java?
Which sorting is best in java?
Is void a data type in java?
Is there is any difference between a scrollbar and a scrollpane?
What is string builder in java?
What is the use of predicate in java 8?