单项选择题
现有:classBird{voidtalk(){System.out.print("chirp");}}classParrot2extendsBird{protectedvoidtalk(){System.out.print("hello");publicstaticvoidmain(String[]args){Bird[]birds={newBird(),newParrot2()};for(Birdb:birds)B.talk();}}结果是什么?()
A.chirpchirp
B.hellohello
C.chirphello
D.编译错误
A.out.print("chirp");}}classParrot2extendsBird{protectedvoidtalk(){System.out.print("hello");publicstaticvoidmain(String[]args){Bird[]birds={newBird(),newParrot2()};for(Birdb:birds)B.talk();}}结果是什么?()
A.chirpchirp
B.hellohello
C.chirphello
D.编译错误