Q. What is the result of the following code snippet?

interface MyInterface {
void myMethod();
}
public class MyClass implements MyInterface {
public void myMethod() {
System.out.println("Implementation");
}
public static void main(String[] args) {
MyInterface obj = new MyClass();
obj.myMethod();
}
}

  • (A) Compilation error
  • (B) Runtime exception
  • (C) MyClass
  • (D) Implementation
πŸ’¬ Discuss
βœ… Correct Answer: (D) Implementation

You must be Logged in to update hint/solution

πŸ’¬ Discussion


πŸ“Š Question Analytics

πŸ‘οΈ
97
Total Visits
πŸ“½οΈ
1 y ago
Published
πŸŽ–οΈ
Pooja
Publisher
πŸ“ˆ
96%
Success Rate