关于下述代码,说法正确的是?package shapes;abstract class Triangle {abstract String getDescription();}class RightTriangle extends Triangle {protected String getDescription() { return "rt"; } // g1}public abstract class IsoscelesRightTriangle extends RightTriangle { // g2public String getDescription() { return "irt"; }public static void main(String[] edges) {final Triangle shape = new IsoscelesRightTriangle(); // g3System.out.print(shape.getDescription());}}
选项:
A:无法编译 因为 g1行
B:无法编译 因为 g2行
C:无法编译 因为 g3行
D:代码可编译且运行无问题
发布时间:2024-05-15 09:42:54