| preferred AP College board partner for AP classes
AP Computer Science A/Unit 9: Inheritance
Start Practice TestPractice Test
About Exam
hard Solved by 1 students
Static Method Hiding
< Prev
Next >

What is printed when the main() method of class Child 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

Parent

B

Child

C

Compilation Error

D

Runtime Error

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.

No comments yet. Be the first to comment!

AI Tutor

How can I help?

APFIVE © 2020.
Email: [email protected]|Privacy Policy