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
What all access modifiers are allowed for top class ?
What is the purpose of the wait(), notify(), and notifyall() methods in java programming?
What is the difference between an inner class and a sub-class?
Explain the difference between intermediate and terminal operations in java8?
What is abstract class? Explain
Can an abstract class be a final class?
What is passed by reference and pass by value ?
What does three dots mean in java?
What is a percentage sign called?
What are wrapped classes in java programming?
Explain about anonymous inner classes in java?
What do you mean by composition in java?
What do you mean by byte code?
What are void methods?
How is java created?