单项选择题
现有:
1. abstract class Color2 {
2. //insert code here
3. }
4.
5. public class Blue2 extends Color2 {
6.public String getRGB() { return "blue"; }
7. }
和4个声明:
public abstract String getRGB();
abstract String getRGB();
private abstract String getRGB();
protected abstract String getRGB();
分别插入到第2行,有多少行可以编译?()
A. 0
B. 1
C. 2
D. 3
点击查看答案&解析
相关考题
-
单项选择题
现有: 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
