現(xiàn)有:
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 () ;
}
}
結(jié)果是什么 ?()
A. chirp chirp
B. hello hello
C. chirp hello
D.編譯錯誤