当前位置: 答题翼 > 问答 > 计算机类考试 > 正文
目录: 标题| 题干| 答案| 搜索| 相关
问题

publicclassPet{publicvoidspeak(){System.out.print(Pet”);}}publicclassCatextendsPet{publicv


publicclassPet{publicvoidspeak(){System.out.print(Pet”);}}publicclassCatextendsPet{publicvoidspeak(){System.out.print(Cat”);}}publicclassDogextendsPet{publicvoidspeak(){System.out.print(Dog”);}}执行代码Pet[]p={newCat(),newDog(),newPet()};for(inti=0;i〈p.length;i++)p[i].speak();后输出的内容是哪项?()

A、PetPetPet

B、CatCatCat

C、CatDogPet

D、CatDogDog

参考答案
您可能感兴趣的试题
  • 共用题干第一篇TapeStore: A New Tape Storage Syst

  • 共用题干第一篇TapeStore: A New Tape Storage Syst

  • 共用题干第一篇TapeStore: A New Tape Storage Syst

  • The most crucial problem any economic syst

  • publicclassPet{privateStringname;publicPet(Stringname){this.name=name;}publicvoidspeak(){S

  • publicclassPet{}publicclassCatextendsPet{}执行代码Catc=newCat();Petp=(Pet)c;下列哪项是正确的?