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

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

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

You must be Logged in to update hint/solution

πŸ’¬ Discussion


πŸ“Š Question Analytics

πŸ‘οΈ
105
Total Visits
πŸ“½οΈ
1 y ago
Published
πŸŽ–οΈ
Vinay
Publisher
πŸ“ˆ
84%
Success Rate