A
Q. What is the result of the following code snippet?
class Parent {
void display() {
System.out.println("Parent");
}
}
class Child extends Parent {
void display() {
System.out.println("Child");
}
}
public class Main {
public static void main(String[] args) {
Parent obj = new Child();
obj.display();
}
}
- Correct Answer - Option(C)
- Views: 8
- Filed under category Java
- Hashtags:
Discusssion
Login to discuss.