欢迎来到天天文库
浏览记录
ID:37702783
大小:100.50 KB
页数:15页
时间:2019-05-29
《201 Sun SATC Java程序员(全真卷01)》由会员上传分享,免费在线阅读,更多相关内容在教育资源-天天文库。
1、SUNSATCJava程序员培训全真卷01全真题011:单选(1分)JVM在执行一个Java类时,大致采用以下过程?A装载类-〉校验类-〉执行类中的代码B校验类-〉装载类-〉执行类中的代码C装载类-〉执行类中的代码-〉校验类D执行类中的代码-〉装载类-〉校验类2:单选(1分)publicclassParent{publicvoidchange(intx){}}publicclassChildextendsParent{//覆盖父类change方法}下列哪个声明是正确的覆盖了父类的change方法?Aprotectedvoidchange(intx){}Bpublicvoid
2、change(intx,inty){}Cpublicvoidchange(Strings){}Dpublicvoidchange(intx){}3:单选(1分)publicclassEmployee{privateStringname;publicEmployee(Stringname){this.name=name;}publicStringgetName(){returnname;}}publicclassManagerextendsEmployee{privateStringdepartment;publicManager(Stringname,Stringdepar
3、tment){this.department=department;super(name);System.out.println(getName());}}执行语句newManager(“smith”,”SALES”)后程序的输出是哪项?AsmithBnullCSALESD编译错误4:单选(1分)publicclassPet{privateStringname;publicPet(){System.out.print(1);}publicPet(Stringname){System.out.print(2);15/15SUNSATCJava程序员培训全真卷01}}publi
4、cclassDogextendsPet{publicDog(){System.out.print(4);}publicDog(Stringname){super(name);System.out.print(3);}}执行newDog(“棕熊”);后程序输出是哪项?A33B13C23D1235:单选(1分)为了使得System.out.println()输出对象引用的时候得到有意义的信息,我们应该覆盖Object中的哪个方法?AequalsBhashCodeCtoStringDnotify6:单选(1分)publicclassPet{privateStringname;pu
5、blicPet(Stringname){this.name=name;}publicvoidspeak(){System.out.print(name);}}publicclassDogextendsPet{publicDog(Stringname){super(name);}publicvoidspeak(){super.speak();System.out.print(“Dog”);}}执行代码Petpet=newDog(“京巴”);pet.speak();后输出的内容是哪项?A京巴B京巴DogCnullDDog京巴7:单选(1分)publicclassPet{publ
6、icvoidspeak(){System.out.print(“Pet”);15/15SUNSATCJava程序员培训全真卷01}}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();后输出的内容是
7、哪项?APetPetPetBCatCatCatCCatDogPetDCatDogDog8:单选(1分)用于执行Java程序的JDK工具是?AjavacBjdbCjavaDjunit9:单选(1分)现有:2.classCat{3.Cat(intc){System.out.print("cat"+c+"");}4.}5.classSubCatextendsCat{6.SubCat(intc){super(5);System.out.print("cable");}7.SubCat(){this(4);}8.public
此文档下载收益归作者所有