Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...

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

Unlike data fields, method names can be duplicated. This is
an important feature that allows method overriding, which
in turn facilitates polymorphism in the design of object-
oriented programs. Method overriding allows a subclass to
provide its own implementation of a method already provided
by one of its superclasses. When a method is called on an
object, IDL searches for a method of that class with that
name. If found, the method is called. If not, the methods
of any inherited object classes are examined in the order
their INHERITS specifiers appear in the structure
definition, and the first method found with the correct
name is called. If no method of the specified name is
found, an error occurs.

We can think of overriding as redefining. When we want to
redefine an inherited behaviour in a more specialised way,
we must provide implementation with the exact method
signature as the inherited method (that we want to
redefine).


For example:

If I define class A:
class A{
void m(){
}
}
We can be making objects from A like this:
A a = new A;
And we can call its method m like this:
a.m();

If we also define class B as a child of A like this:
class B extends A {
}
Then we know it inherits method m from its parent, class A

So we can do this:
B b = new B();
b.m();
The above works because m is inherited.

if u dont understand go through this link.
http://www.tgs.com/support/oiv-java-
release_notes/extension/guide_content.html

Is This Answer Correct ?    3 Yes 15 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Explain what do you mean by functional overloading in java?

951


What is an empty list in java?

919


what is static import in java? Explain

961


What does isempty () do in java?

1000


What is the use of jtable?

1060


Can a class be private in java?

942


What is Java Annotations?

1016


What is a local, member and a class variable?

972


How do you reverse a string in java without using string buffer?

1039


What is use of functional interface in java 8? Explain

944


How to print an arraylist in java?

1000


Describe what a thread-local variable is in java?

960


Explain the Propertie sof class?

993


How do weakhashmap works?

1092


How can a gui component handle its own events?

1042