Implements is a keyword used while using interfaces and eXtends is used while using inheritance.
For eg :
Interface Vehicle {
public String getEngine();
public String getHorn();
}
class Car implements Vehicle {
public String getEngine() {
return "Car Engine";
}
public String getHorn() {
return "Wolf Horn";
}
}
public class BMW extends Car {
public void myMethod() {
System.out.println("BMW CAR");
}
public String getEngine() {
return "BMW Car Engine";
}
public String getHorn() {
return "Air horn";
}
public static void main(String[] args) {
\\todo
}
}
Usually interface meant for generalization and inheritance meant for specialization.
The interface Vehicle is providing generic information regarding vehicle. But Car implements Vehicle and provides generic information about car. But BMW extends Car class and provide specific details about BMW.
> Implements is only used when there is an inheritance
> between a class and one or more interfaces.
No; it applies to methods declared with the same name and signature as a method declared in a superinterface or an abstract superclass.
[EDIT] Ah. I missed that the question was about the keyword interface. My apologies.
~
To ring the changes:
interface I {}
interface J {}
interface K extends I {}
interface L extends I, J {}
class C {}
class D extends C {}
class E implements I {}
class F extends C implements I {}
class G extends C implements I, J {}
Whew! That's the fastest nine types I've ever defined.
> To ring the changes:
Don't forget enum.
enum A implements I {}
enum B implements I, J {}
An enum cannot extend a class because it already implicitly extends Enum. A class cannot extend an enum because enums are final. But enums can implement interfaces (and in fact they implicitly implement Serializable to start with).