Java认证考试综合练习 题目列表
单选题现有如下五个声明: Linel: int a_really_really_really_long_variable_name=5 ; Line2: int _hi=6; Line3: int big=Integer. getlnteger("7”); Line4:int $dollars=8; line5: int %opercent=9; 哪行无法通过编译?()ALine1BLine3CLine4DLine5
单选题以下关于File对象的描述中,错误的是()AFile对象是不可变的,一旦创建,它所指向的文件就不能改变;BFile对象不一定要指向实际存在的文件或文件夹;CFile类具有强大的文件和文件夹操作能力;DFile对象的功能仅限于关于文本文件;
单选题public void testIfA(){ if(testIfB("True")){ System.out.println("True"); }else{ System.out.println("Nottrue"); } } public Boolean testIfB(Stringstr){ return Boolean.valueOf(str); } What is the result when method testIfA is invoked?()ATrueBNottrueCAnexceptionisthrownatruntime.DCompilationfailsbecauseofanerroratline12.ECompilationfailsbecauseofanerroratline19.
单选题现有: class Test2 f public static void main (String [] args) { boolean X= true; boolean y=false; short Z=20; if((x==true) & (y=true)) z++; if((y==true) || (++z==22)) z++; System. out .println( "z="+z); } 结果是什么?()AZ=21BZ=22CZ=23DZ= 24
单选题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
单选题class Test4 { public static void main(String [] args) { boolean x = true; boolean y = false; short z = 42; if((z++ = = 42) (y = true)) z++; if((x = false) || (++z = = 45)) z++; System.out.println("z = " + z); } } 结果为:()Az = 42Bz = 44Cz = 45Dz = 46
单选题class Order3 implements Runnable { public static void main(String [] args) { new Thread(new Order3()).start(); for(int x = 0; x 〈 10; x++) System.out.print("m"); } public void run() { for(int x = 0; x 〈 10; x++) { //insert code here System.out.print("r"); } } } 和: 当代码被编译并照此运行时产生 "before" 的输出, 当下列内容插入到代码第8行时产生"after"输出 if (x 〉 3 x 〈 7) Thread.yield(); 对比“before”的输出结果和“after”的输出结果,下面哪一项是正确的?()A输出字符的总数可能改变。B当添加额外的代码时,编译将失败。C在“after”输出结果中,字符“m”较早出现的可能性较小。D在“after”输出结果中,字符“m”较早出现的可能性较大。
多选题对于变量的初始化,以下几种方法中错误的是()Aint a; for (int i=0;i《12;i++) a=i;Bint a; if (true) a=7;Cint a; int b=a;Dint a=0;Eint a; a=0;
多选题现有: class ClassA {} class ClassB extends ClassA {) class ClassC extends ClassA {) 以及: ClassA p0=new ClassA(); ClassB pl=new ClassB(); ClassC p2=new ClassC(); ClassA p3=new ClassB(); ClassA p4=new ClassC(); 下列哪些是正确的?()Ap0=pl;Bp1 =p2;Cp2=p4;Dp2 = (ClassC)pl;Ep1 = (ClassB)p3;Fp2 = (Classc)p4;
单选题1.public classA{ 2.public String doit(intx,inty){ 3.return"a"; 4.} 5. 6.public String doit(int...vals){ 7.return"b"; 8.} 9.} And: 25.A a=new A(); 26.System.out.println(a.doit(4,5)); What is the result?()ALine 26 prints a to System.out.BLine 26 prints b to System.out.CAn exception is thrown at line 26 at runtime.DCompilation of class A will fail due to an error in line 6.
判断题Integer对象中的值是可变的A对B错