问题:
现有:
class Bird {
void talk() { System.out.print("chirp "); }
}
class Parrot2 extends Bird {
protected void talk() { System.out.print("hello ");
public static void main(String [] args) {
Bird [] birds = {new Bird(), new Parrot2 () };
for( Bird b : birds)
b.talk () ;
}
}
结果是什么 ?()
A . chirp chirp
B . hello hello
C . chirp hello
D . 编译错误
现有:
class Bird {
void talk() { System.out.print("chirp "); }
}
class Parrot2 extends Bird {
protected void talk() { System.out.print("hello ");
public static void main(String [] args) {
Bird [] birds = {new Bird(), new Parrot2 () };
for( Bird b : birds)
b.talk () ;
}
}
结果是什么 ?()
● 参考解析
本题暂无解析
相关内容
相关标签