public class Pet{} public class Cat extends Pet{} 执行代码 Cat c = new Cat(); Pet p = (Pet)c; 下列哪项是正确的? A、Pet p = (Pet)c正常执行B、Pet p = (Pet)c编译错误C、Pet p = (Pet)c运行错误D、以上都不对
public class Pet{} public class Cat extends Pet{} 执行代码 Cat c = new Cat(); Pet p = (Pet)c; 下列哪项是正确的?
- A、Pet p = (Pet)c正常执行
- B、Pet p = (Pet)c编译错误
- C、Pet p = (Pet)c运行错误
- D、以上都不对
相关考题:
如下程序的输出结果是______。 include using namespace std; class Pet{ char nam 如下程序的输出结果是______。include<iostream>using namespace std;class Pet{char name[10];public:Pet(char*nanle){strcpy(this->name,name);}const char*getName( )const{return name;}virtual void call( )eonst=0;};class Dog:public Pet{public:Dog(char*name):Pet(name){ }void call( )eonst{cout<<"汪汪叫";}};class Cat:public Pet{public:Cat(char*name):Pet(name){ }void call( )const{eout<<"喵喵叫";}};int main( ){Pet*petl=new Dog("哈克"),*pet2=new Cat("吉米");eout<<petl->getName( );petl->call( );eout<<endl;cout<<pet2->getName( );pet2->call( );eout<<endl;return 0;}
publicclassPet{}publicclassCatextendsPet{}执行代码Catc=newCat();Petp=(Pet)c;下列哪项是正确的? A.Petp=(Pet)c正常执行B.Petp=(Pet)c编译错误C.Petp=(Pet)c运行错误D.以上都不对
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.PetPetPetB.CatCatCatC.CatDogPetD.CatDogDog
现有:publicclassPet()publicclassCatextendsPet{)执行代码Catc-newCat();Petp=(Pet)c;后下列哪项是正确的?() A.Petp=(Pet)c运行错误B.Petp=(Pet)c编译错误C.Petp=(Pet)c止常执行D.以上都不对
有如下程序: include using namespace std; class Pet{ char name[10]; public: Pet(c 有如下程序:include<iostream>using namespace std;class Pet{char name[10];public:Pet(char*name){strcpy(this->name,name);}const char*getName()const {return name;}virtual void call()const=0;};class Dog:public Pet{public:Dog(char*name):Pet(name){}void call()const{cout<<"汪汪叫":}};class Cat:public Pet{public:Cat(char*name):Pet(name){}void call()const{cout<<"喵喵叫";}};int main(){Pet*pet1=new Dog("哈克"),*pet2=new Cat("吉米");cout<<pet1->getName();pet1->call();cout<<end1;cout<<pet2->getName();pet2->call();cout<<end1;return 0;}程序的输出结果是______。
The sense relation of the following pair of sentences is that__________.X: Mary's pet cat was stolen.Y: Marry has a pet cat.A.X entails YB.X presupposes YC.X is inconsistent with YD.X is synonymous with Y
public class Pet{ private String name; public Pet(){ System.out.print(1); } public Pet(String name){ System.out.print(2); } } public class Dog extends Pet{ public Dog(String name){ System.out.print(3); } } 执行new Dog(“棕熊”);后程序输出是哪项?() A、 23B、 13C、 123D、 321
public class Pet{ private String name; public Pet(String name){ this.name = name; } public void speak(){ System.out.print(name); } } public class Dog extends Pet{ public Dog(String name){ super(name); } public void speak(){ super.speak(); System.out.print(“ Dog ”); } } 执行代码 Pet pet = new Dog(“京巴”); pet.speak(); 后输出的内容是哪项?() A、 京巴B、 京巴 DogC、 nullD、 Dog京巴
public class Pet{ private String name; public Pet(){ System.out.print(1); } public Pet(String name){ System.out.print(2); } } public class Dog extends Pet{ public Dog(){ System.out.print(4); } public Dog(String name){ super(name); System.out.print(3); } } 执行new Dog(“棕熊”);后程序输出是哪项?() A、 33B、 13C、 23D、 123
现有: public class Pet( ) public class Cat extends Pet{) 执行代码 Cat c- new Cat( ); Pet p= (Pet)c; 后下列哪项是正确的?()A、Petp=(Pet)c运行错误B、Petp=(Pet)c编译错误C、Petp=(Pet)c止常执行D、以上都不对
public class Pet{ private String name; public Pet(){ System.out.print(1); } public Pet(String name){ System.out.print(2); } } public class Dog extends Pet{ public Dog(String name){ //这里隐藏了一句代码:super.pet(); System.out.print(3); } } 执行new Dog(“棕熊”);后程序输出是哪项?() A、 23B、 1 3C、 123D、 321
现有: public class Pet() public class Cat extends Pet{) 执行代码 Cat c- new Cat(); Pet p= (Pet)c; 后下列哪项是正确的?() A、 Pet p=(Pet)c运行错误B、 Pet p=(Pet)c编译错误C、 Pet p= (Pet)c止常执行D、以上都不对
public class Pet{ private String name; public Pet(){ System.out.print(1); } public Pet(String name){ System.out.print(2); } } public class Dog extends Pet{ public Dog(){ System.out.print(4); } public Dog(String name){ //这里隐藏了一句代码:super.pet(); this(); System.out.print(3); } } 执行new Dog(“棕熊”);后程序输出是哪项?() A、 143B、 423C、 243D、 1134
public class Pet{ public void speak(){ System.out.print(“ Pet ”); } } public class Cat extends Pet{ public void speak(){ System.out.print(“ Cat ”); } } public class Dog extends Pet{ public void speak(){ System.out.print(“ Dog ”); } } 执行代码 Pet[] p = {new Cat(),new Dog(),new Pet()}; for(int i=0;i〈p.length;i++) p[i].speak(); 后输出的内容是哪项?() A、Pet Pet PetB、Cat Cat CatC、Cat Dog PetD、Cat Dog Dog
public class Pet{ private String name; public Pet(){ System.out.print(1); } public Pet(String name){ System.out.print(2); } } public class Dog extends Pet{ public Dog(){ System.out.print(4); } public Dog(String name){ this(); System.out.print(3); } } 执行new Dog(“棕熊”);后程序输出是哪项?() A、 143B、 423C、 243D、 1134
关于SPECT/PET与PET的比较,下列哪些不正确()A、SPECT/PET与PET均采用符合探测原理B、SPECT/PET在空气中的分辨率可达4.5mm,与PET接近C、SPECT/PET兼备单光子和F正电子成像D、PET只能进行F正电子成像E、SPECT/PET和PET均能进行快速动态显像
单选题public class Pet{ private String name; public Pet(){ System.out.print(1); } public Pet(String name){ System.out.print(2); } } public class Dog extends Pet{ public Dog(String name){ System.out.print(3); } } 执行new Dog(“棕熊”);后程序输出是哪项?()A 23B 13C 123D 321
单选题现有: public class Pet( ) public class Cat extends Pet{) 执行代码 Cat c- new Cat( ); Pet p= (Pet)c; 后下列哪项是正确的?()APetp=(Pet)c运行错误BPetp=(Pet)c编译错误CPetp=(Pet)c止常执行D以上都不对
单选题public class Pet{ private String name; public Pet(String name){ this.name = name; } public void speak(){ System.out.print(name); } } public class Dog extends Pet{ public Dog(String name){ super(name); } public void speak(){ super.speak(); System.out.print(“ Dog ”); } } 执行代码 Pet pet = new Dog(“京巴”); pet.speak(); 后输出的内容是哪项?()A 京巴B 京巴 DogC nullD Dog京巴
单选题public class Pet{ private String name; public Pet(){ System.out.print(1); } public Pet(String name){ System.out.print(2); } } public class Dog extends Pet{ public Dog(String name){ //这里隐藏了一句代码:super.pet(); System.out.print(3); } } 执行new Dog(“棕熊”);后程序输出是哪项?()A 23B 1 3C 123D 321
多选题关于SPECT/PET与PET的比较,下列哪些不正确()ASPECT/PET与PET均采用符合探测原理BSPECT/PET在空气中的分辨率可达4.5mm,与PET接近CSPECT/PET兼备单光子和F正电子成像DPET只能进行F正电子成像ESPECT/PET和PET均能进行快速动态显像
单选题public class Pet{ public void speak(){ System.out.print(“ Pet ”); } } public class Cat extends Pet{ public void speak(){ System.out.print(“ Cat ”); } } public class Dog extends Pet{ public void speak(){ System.out.print(“ Dog ”); } } 执行代码 Pet[] p = {new Cat(),new Dog(),new Pet()}; for(int i=0;i〈p.length;i++) p[i].speak(); 后输出的内容是哪项?()APet Pet PetBCat Cat CatCCat Dog PetDCat Dog Dog
单选题现有: public class Pet() public class Cat extends Pet{) 执行代码 Cat c- new Cat(); Pet p= (Pet)c; 后下列哪项是正确的?()A Pet p=(Pet)c运行错误B Pet p=(Pet)c编译错误C Pet p= (Pet)c止常执行D以上都不对
单选题public class Pet{} public class Cat extends Pet{} 执行代码 Cat c = new Cat(); Pet p = (Pet)c; 下列哪项是正确的?APet p = (Pet)c正常执行BPet p = (Pet)c编译错误CPet p = (Pet)c运行错误D以上都不对