Suppose you create a class Cylinder to be a subclass of Circle. Analyze the following code: class Cylinder extends Circle { double length; Cylinder(double radius) { Circle(radius); } }
A、Theprogramcompilesfine,butyoucannotcreateaninstanceofCylinderbecausetheconstructordoesnotspecifythelengthofthecylinder;
B、TheprogramhasacompileerrorbecauseyouattemptedtoinvoketheCircleclass'sconstructorillegally;
C、Theprogramcompilesfine,butithasaruntimeerrorbecauseofinvokingtheCircleclass'sconstructorillegally;
D、Theprogramcompilesandrunfine
发布时间:2025-11-18 12:13:29