Question

What will be the output of the following code:  class Parent {     static void display() {         System.out.println("Parent");     } } class Child extends Parent {     static void display() {         System.out.println("Child");     } } public class Test {     public static void main(String[] args) {         Parent p=new Child();         p.display();            } }

A Compilation Error
B Parent
C Child
D Run-time Error
E Parent Child
Practice Next

Hey! Ask a query

🎓
Think You're Ready for RBI Grade B?
RBI Grade B 2026 Phase 1 Memory Based Paper
  • 200 Questions with Detailed Solutions
  • Section-wise Coverage (GA, English, Quant & Reasoning)