What is the result of the following code snippet?
abstract class MyAbstract {
abstract void myMethod();
}
class MyClass extends MyAbstract {
void myMethod() {
System.out.println("Implementation");
}
public static void main(String[] args) {
MyAbstract obj = new MyClass();
obj.myMethod();
}
}
abstract void myMethod();
}
class MyClass extends MyAbstract {
void myMethod() {
System.out.println("Implementation");
}
public static void main(String[] args) {
MyAbstract obj = new MyClass();
obj.myMethod();
}
}
A. Runtime exception
B. Implementation
C. MyClass
D. None of these
Answer: Option B

Join The Discussion