Answer Posted / sudhakar sahoo
1.Mark the class as final to avoid subclass, So subclass
can't change any thing in super class.
2. When ever you are chaning any property of that class
make a new instance of that calss.
e.g public modify(Object obj0)
{
ClassName a =new ClassName ();
a.modify()// modification logioc
}
| Is This Answer Correct ? | 3 Yes | 5 No |
Post New Answer View All Answers
Can It is possible to synchronize the constructor of a Java Class?
What are the different ways of implementing thread? Which one is more advantageous?
How does callback work in java?
What is the return type of the main method?
What is the difference between preparedstatement and statement in java?
What are the principle concepts of oops?
What is regex in java?
What if static is removed from main method?
Is {a, n, d} a palindrome? If you are given a random string, is it a palindrome or not?
What is the difference between the ">>" and " >>>" operators in java?
How do you write methodology?
Can we sort set in java?
What are the differences between path and classpath variables?
What is a priority queue java?
What is bubble sorting in java?