Interfaces 2
Interfaces 2
void methodA();
}
interface B {
void methodB();
}
class C implements A, B {
public void methodA() {
System.out.println("Method A implementation");
}
class D {
void methodD() {
System.out.println("Method D from class D");
}
}
interface A {
void methodA();
int number();
}
interface B extends A {
void methodB();
}
class C implements B {
public void methodA() {
System.out.println("Method A from interface A");
}
Summary:
-An interface cannot inherit from a class.
-A class can implement multiple interfaces.
-A class can extend a class and at the same time
implement one or more interfaces.
-Interfaces can extend other interfaces.