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 is maximum size of arraylist in java?
What is the use of :: in java?
What is the benefit of abstract class?
Can we increase array size dynamically in java?
What is the loop in java?
What is the difference between numeric and integer?
What is the unit of plancks constant?
What is a java developer salary?
What happens if constructor is private?
what r advatages of websphere? & how to deploy?
What is arraylist e in java?
Can we call the constructor of a class more than once for an object?
What is the default size of set in java?
What are the five major types of reference sources?
How do you stop a thread in java?