πŸ“Š JAVA
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();
}
}
  • (A) Default Implementation
  • (B) Compilation error
  • (C) Runtime exception
  • (D) MyClass
πŸ’¬ Discuss
βœ… Correct Answer: (A) Default Implementation

You must be Logged in to update hint/solution

πŸ’¬ Discussion


πŸ“Š Question Analytics

πŸ‘οΈ
106
Total Visits
πŸ“½οΈ
1 y ago
Published
πŸŽ–οΈ
Praveen Singh
Publisher
πŸ“ˆ
91%
Success Rate