interface A {
void methodA();
}
interface B {
void methodB();
}
// Class C implements both interfaces A and B
class C implements A, B {
public void methodA() {
System.out.println("Method A implementation");
}
public void methodB() {
System.out.println("Method B implementation");
}
}
public class Main {
public static void main(String[] args) {
C obj = new C();
obj.methodA(); // Output: Method A implementation
obj.methodB(); // Output: Method B implementation
}
}
No comments:
Post a Comment