AP Computer Science Aeasymcq1 pt

If class B extends A, the statement A x = new B() is

A.legal
B.a compile error
C.a runtime error
D.only legal with a cast

Explanation

Core Concept

A subclass object fits a superclass reference.

Correct Answer

Alegal

More Unit 9: Inheritance practice questions

Try a random question →

Practice more AP Computer Science A questions with full explanations

Practice Unit 9: Inheritance Questions →