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


Please Help Members By Posting Answers For Below Questions

How will you call an Applet using Java Script Function?

544


What are the main uses of this keyword?

601


how its run?

571


Explain the scope of a variable.

638


How to split a string in java?

628






We are seeing so many videos/audios as many web sited. But question is these videos or audios are stored in Databases ( Oracle, Mysql, Sybase,... ) or stored any file directory from there they will give the link for that? Pls explain and give sample code to achieve this one? Thanks, Seenu.

1488


What is palindrome in java?

562


How does queue work in java?

532


Explain about version control?

596


Is java se free?

524


Give an example of call be reference significance.

611


Can you make a constructor final in Java?

628


What is the purpose of java?

558


Can a class extend 2 classes in java?

559


Can a abstract class be defined without any abstract methods?

562