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

Polymorphism and Method Overloading

Mark
< Prev
Next >

What is printed when the main method is executed?

public class Base {
    public void process(Base b) {
        System.out.println("Base");
    }
}

public class Derived extends Base {
    public void process(Derived d) {
        System.out.println("Derived");
    }
}

public class Main {
    public static void main(String[] args) {
        Base b = new Derived();
        b.process(b);
    }
}
A

Compilation Error

B

Base

C

Derived

D

Base Derived

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|