单项选择题
classBird{staticvoidtalk(){System.out.print("chirp");}}classParrotextendsBird{staticvoidtalk(){System.out.print("hello");}publicstaticvoidmain(String[]args){Bird[]birds={newBird(),newParrot()};for(Birdb:birds)b.talk();}}结果为:()
A.chirpchirp
B.chirphello
C.hellohello
D.编译失败
A.out.print("chirp");}}classParrotextendsBird{staticvoidtalk(){System.out.print("hello");}publicstaticvoidmain(String[]args){Bird[]birds={newBird(),newParrot()};for(Birdb:birds)b.talk();}}结果为:()
A.chirpchirp
B.chirphello
C.hellohello
D.编译失败