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 / imambasha

hi
MethodOverriding is the concept which implements Dynamic
Code(Method) binding.
i.e., The method which is going to bind or execute is
decided at the runtime basing on the Object that we are
using to call that method...
Suppose assume we have two Classes A,B Where class B is
inheriting class A.And even we have overridden(given
different implementation with same method signature)a
method of class A in class B.
Now the criteria is which method(superclass method or
subclsas overridden method) is to be called or executed is
determined based on the object(class A object Or class B
object) we are using to call that method............

Is This Answer Correct ?    9 Yes 22 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

How do you access command-line arguments within the code?

778


What is java virtual machine? Explain

747


What's the default access specifier for variables and methods of a class?

722


What is the symbol for space?

736


What is one third plus one third as a fraction?

657


What is an infinite loop?

753


What is the use of 'super' keyword inside a constructor?

724


When should I use singleton pattern?

782


Is java a prime method?

718


How many decimal places is a double?

712


How to convert string to byte array and vice versa?

760


is there a separate stack for each thread in java? : Java thread

745


Can we override constructor?

742


Why is serialization required?

715


Why do we need autoboxing in java?

735