what is the purpose of method overriding in java where v r
completely re-defining a inherited method instead y can't v
create a new method and define.If the question is very silly
plz excuse me and do reply.Thank U!
Answer Posted / kv
The answer lies in Object Oriented concept. When you are
overriding a method, you overriding the internal details of
default behavior. But your interface to external world is
not changed. Example, Base class employee has a method
commuteToWork(). All the manager in the company has given
the company car and a driver. Their implementation of
commuteToWork will be different from the non manager
employees. If you add a new method saying
commuteToWorkByCar(), every Monday morning you would need to
call different method for each subtype of employee. Hope it
will help.
| Is This Answer Correct ? | 13 Yes | 23 No |
Post New Answer View All Answers
Why scanner is used in java?
How does the java compiler work?
Difference between character constant and string constant in java ?
What super () does in java?
Is vector ordered in java?
Can one thread block the other thread?
What is a condition in programming?
What is boolean flag in java?
How can we run a java program without making any object?
Why java is considered as platform independent?
Does apple use java?
What is the difference between final, finally and finalize() in java?
Define a java class.
What are untrusted applets?
State two differences between C and Java.