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

Inheritance and Method Overloading

Mark
< Prev
Next >

What is the output when the main method is executed?

class Base {
    public void test(int a) {
         System.out.print("Base");
    }
}

class Derived extends Base {
    public void test(double a) {
         System.out.print("Derived");
    }
}

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

Base

B

Compilation Error

C

Derived

D

BaseDerived

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|