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
What is difference between static and abstract class?
Give me example of derived data types.
What is string substring?
How do you create a method in java?
what is the volatile modifier for? : Java thread
What is json parser in java?
Can a class be final?
can I implement my own start() method? : Java thread
What are thread priorities and importance of thread priorities in java?
What does the ‘static’ keyword mean? Is it possible to override private or static method in java?
What is the difference between super class & sub class?
What does @param args mean in java?
2) Suppose there are 5 directories having lot of files (say txt files) in each directory. 2 things :- 2.1) You want to search for filenames which have a particular pattern. 2.2) Out of these filtered files you want to search for a particular keyword or a search string. How can you achieve this?
Explain different forms of polymorphism?
Can we initialize the final blank variable?