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
How do you implement singleton class?
What is the abstract class?
Why should we use singleton pattern instead of static class?
What is Recursion Function?
What is difference between string and new string?
What is the maximum size of array in java?
Considering notepad/ie or any other thing as process, what will happen if you start notepad or ie 3 times? Where 3 processes are started or 3 threads are started?
What are the advantages of java over cpp?
What is the size of boolean variable?
what is a green thread? : Java thread
what is use of functional interface in java 8?
Write a java program to generate fibonacci series ?
Can we override the overloaded method?
Write down program for following scenario. Use java coding standard. You have array list with some words in it..we will call it as dictionary….and you have a arbitrary string containing some chars in it. You have to go through each word of dictionary and find out if that word can be constructed with the help of chars from arbitrary string given. If you find the word print it else print none.
When object is created and destroyed?