问题:
class Bird {
static void talk() { System.out.print("chirp "); }
}
class Parrot extends Bird {
static void talk() { System.out.print("hello "); }
public static void main(String [] args) {
Bird [] birds = {new Bird(), new Parrot()};
for( Bird b : birds)
b.talk();
}
}
结果为:()
A . chirp chirp
B . chirp hello
C . hello hello
D . 编译失败
class Bird {
static void talk() { System.out.print("chirp "); }
}
class Parrot extends Bird {
static void talk() { System.out.print("hello "); }
public static void main(String [] args) {
Bird [] birds = {new Bird(), new Parrot()};
for( Bird b : birds)
b.talk();
}
}
结果为:()
● 参考解析
本题暂无解析
相关内容
相关标签