overriden methods provide one interface multiple methods.
what is meant by one interface multiple methods

Recommended Answers

All 4 Replies

From Wiki,

Method overriding, in object oriented programming, is a language feature that allows a subclass to provide a specific implementation of a method that is already provided by one of its superclasses. The implementation in the subclass overrides (replaces) the implementation in the superclass.

sir my doubt is not about over riding ?
what is meant by
one interface multiple methods ?

The question seems ambiguous to me.
Any Java interface can contain many methods.
What this more probably refers to is illustrated in this example:
You have an interface Vehicle that declares a void drive(int speed) method.
class Car implements Vehicle {
void drive.... etc
so does
class Speedboat implements Vehicle {
void drive(...
Now you have one interface, two versions of the method. You can simply call the method, and the appropriate implementatoin is used:
Vehicle v = (something...)
v.drive(30); // calls Car's drive or Speedboat's drive depending on what kind of Vehicle this is.

I suppose here, the word interface doesn't mean the Java language type. What it wants to mean is a contract, much like how it is between a library developer and it's user. The word here maps more closely to the method signature. Something like "overidding allows multiple methods to have the exact same signature" so "one interface, multiple methods"

PS: On reading JC's post again, I guess he's trying to say the same thing.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.