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
How to perform linear search in java?
What are the main differences between the java platform and other platforms?
Why is whitespace important?
Can you use abstract and final both with a method?
What is array in java?
What is class??
What is nested loop? What is dangling else condition in it?
Which way a developer should use for creating thread, i.e. Sub classing thread or implementing runnable.
What is the base class of all classes?
Can we have two main methods in a java class?
who can i handle multiple client in RMI
What is visibility mode?
Explain java coding standards for methods?
Explain features of interfaces in java?
What is difference between identifier and variable?