answersLogoWhite

0


Best Answer

Java uses the least-abstract implementation of a method. If a method is called on an object, it searches the current object for an implementation. If no such implementation exists, Java looks to the object.super class for the method. It keeps searching up the superclass list until it finds a method or gets to the Object superclass and throws a NoSuchMethodException.

User Avatar

Wiki User

14y ago
This answer is:
User Avatar
More answers
User Avatar

AnswerBot

6mo ago

Java uses a process called method dispatch, where the most specific version of the method is chosen at runtime. It starts by searching for a matching method in the class where the object is declared. If it finds a match, it will execute that method. If not, it will search the superclasses in the hierarchy until it finds a match or reaches the top of the hierarchy. If multiple methods with the same signature are found at the same level, a compile-time error occurs.

This answer is:
User Avatar

Add your answer:

Earn +20 pts
Q: How does Java decide which method with the same signature to use when the method exists in several levels of a class hierarchy?
Write your answer...
Submit
Still have questions?
magnify glass
imp
Related questions

What does the time signature 5 3 means?

I'm not sure a time signature with a 3 on the bottom exists but if it did it would mean there were 5 dotted crotchets in a bar.


Energy exists in several?

States.


Several reasons exists why electronic and digital signatures?

Digital signatures are based on Public Key Infrastructure (PKI) and verify authenticity. Electronic and digital signatures help to authenticate official records. Electronic records can be authenticated by a signature.


What does the grand jury decide?

If sufficient "Probable Cause" exists to charge the individual wit the crime.


What is polymorphic number?

A number that exists in several different forms.


What does patriarchy mean in a welfare state?

The term patriarchy is not subjective to what type of state it exists within. A patriarchy is a social hierarchy in which men are systematically placed in positions that are favorable to them.


Antonym of lair?

The word lair has several synonyms, but no antonym for it exists.


Can congress decide the metric system?

No. Congress can decide whether or not the metric system is adopted by the US, but the metric system exists and is used by developed countries whatever Congress choses to do.


What is hierachical?

A structure of hierarchy. Example: There exists no God at the top of the hierarchical chain of command of any church, synagogue, temple, etc. Only very powerful people reside there.


How old do you have to be to play in the zone?

MSNZone no longer exists, it has been offline for several years.


Does the Sharp FX have a signature?

F-double-sharp major is a key which exists only in theory and not in practice, it's key signature would have six double-sharps and one B sharp. It's enharmonic is G, which has one sharp, so that'll be preferred.


What does sociologist mean when they say that race and gender are socially constructed?

Because race only exists when people decide there are differences between people :)