| preferred AP College board partner for AP classes
AP Computer Science A/Unit 9: Inheritance
Start Practice TestPractice Test
About Exam
medium Solved by 5 students
Method Overriding and Super Keyword
< Prev
Next >

What is printed when the main method of the Child class is executed?

public class Parent {
    public String shout() { return "Hello"; }
}

public class Child extends Parent {
    public String shout() { return super.shout() + " World"; }
    
    public static void main(String[] args) {
        System.out.println(new Child().shout());
    }
}
A

Hello

B

HelloHello

C

World

D

Hello World

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: apfive@apfive.org|Privacy Policy