Q. What is the result of the following code snippet?
interface MyInterface {
default void myMethod() {
System.out.println("Default Implementation");
}
}
class MyClass implements MyInterface {
public static void main(String[] args) {
MyInterface obj = new MyClass();
obj.myMethod();
}
}
interface MyInterface {
default void myMethod() {
System.out.println("Default Implementation");
}
}
class MyClass implements MyInterface {
public static void main(String[] args) {
MyInterface obj = new MyClass();
obj.myMethod();
}
}
β
Correct Answer: (A)
Default Implementation