Are you taking CLEP classes? Try clep.ai
| preferred AP College board partner for AP classes
AP Computer Science A/Unit 9: Inheritance
Start Practice TestPractice Test
About Exam
hard

Static Method Hiding

Mark
< Prev
Next >

Consider the following class definitions. What is printed when the main method of the Child class is executed?

class Parent {
    public static void show() {
        System.out.println("Parent");
    }
}

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

Child

B

Runtime Error

C

Compilation Error

D

Parent

Hint
Did You Know?
Explain Why
Explain All Answers
Check Answer
Show Correct Answer
Report Question

Question Leaderboard

Not enough data yet to show leaderboard.

AI Tutor

How can I help?

APFIVE © 2020.
Email: apfive@apfive.org|Privacy Policy|