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

class Parent {
void display() {
System.out.println("Parent");
}
}
class Child extends Parent {
public static void main(String[] args) {
Child obj = new Child();
obj.display();
}
}

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

You must be Logged in to update hint/solution

πŸ’¬ Discussion


πŸ“Š Question Analytics

πŸ‘οΈ
104
Total Visits
πŸ“½οΈ
1 y ago
Published
πŸŽ–οΈ
Sandhya Thakur
Publisher
πŸ“ˆ
81%
Success Rate