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

You must be Logged in to update hint/solution

πŸ’¬ Discussion


πŸ“Š Question Analytics

πŸ‘οΈ
157
Total Visits
πŸ“½οΈ
12 mo ago
Published
πŸŽ–οΈ
Rakesh Kumar
Publisher
πŸ“ˆ
96%
Success Rate