单项选择题
现有:
1. abstract class Color {
2.protected abstract String getRGB();
3. }
4.
5. public class Blue extends Color {
6. //insert code here
7. }
和四个声明:
public String getRGB() { return "blue"; }
String getRGB() { return "blue"; )
private String getRGB() { return "blue"; }
protected String getRGB() { return "blue"; )
分别插入到第6行,有几个可以通过编译?()
A. 0
B. 1
C. 2
D. 3
点击查看答案&解析
相关考题
-
单项选择题
现自: 1. interface Color { } 2. interface Weight { } 3. //insert code here 和以下足六个声明: class Boat extends Color, extends Weight { } class Boat extends Color and Weight { } class Boat extends Color, Weight { } class Boat implements Color, implements Weight { } class Boat implements Color and Weight { } class Boat implements Color, Weight { } 分别插入到第3行,有多少行可以编译? ()
A. 0
B. 1
C. 2
D. 3 -
单项选择题
现有: 1. interface Animal f 2. void eat(); 3. } 4. 5. // insert code here 6. 7. public class HouseCat implements Feline { 8. public void eat() { } 9. } 和以下三个接口声明: interface Feline extends Animal ( ) interface Feline extends Animal {void eat(); } interface Feline extends Animal {void eat() { } } 分别插入到第5行,有多少行可以编译?
A. 0
B. 1
C. 2
D. 3 -
单项选择题
下列有关接口的叙述错误的是哪项?()
A.接口中只能包含抽象方法和常量
B.一个类可以实现多个接口
C.类实现接口时必须实现其中的方法
D.接口不能被继承
