Java
11
Вклад в тег
interface MyInterface {
void writeHelloWorld();
}
class A implements MyInterface {
@Override
public void writeHelloWorld() {
System.out.println("A " + "says: Hello World");
}
}
class B implements MyInterface {
@Override
public void writeHelloWorld() {
System.out.println("B " + "says: Hello World");
}
}
class MyClass {
public static void main(String[] args) {
MyInterface myInterfaceA = new A();
MyInterface myInterfaceB = new B();
myInterfaceA.writeHelloWorld();
myInterfaceB.writeHelloWorld();
}
}