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 about main thread in java?
Hi all, I am dng a mini project on FileSplitter application which splits the GBs of logfile into Smaller chunks(mbs) depending on the split size." How to handle GBs file? I am getting OutOfMemoryException, when I input such GB sized file. Thx
If an object is garbage collected, can it become reachable again?
Explain listiterator and methods in listiterator?
Justify your answer that you can't define a method inside another method in java, if you can then how?
What is r * in math?
What happens if we override only equals?
What is the benefit of singleton pattern?
why java uses class level type casting ?
What is purpose of keyword void?
Difference between error and exception
What are exceptions
What is private protected in java?
Write a java program for binary search?
Why Java is not pure Object Oriented language?