资源预览内容
第1页 / 共90页
第2页 / 共90页
第3页 / 共90页
第4页 / 共90页
第5页 / 共90页
第6页 / 共90页
第7页 / 共90页
第8页 / 共90页
第9页 / 共90页
第10页 / 共90页
亲,该文档总共90页,到这儿已超出免费预览范围,如果喜欢就下载吧!
资源描述
1 Copyright Tarena Corporation,2009.All rights reserved JAVASEJAVASE 部分部分 1、Choose the three valid identifiers from those listed below. (Choose three)? A. IDoLikeTheLongNameClass B. $byte C. const D. _ok E. 3_case 答:ABD 2、Which of the following lines of code will compile without error (Choose two)? A. int i=0; if (i) System.out.println(“Hi”); B. boolean b=true; boolean b2=true; if(b=b2) System.out.println(“So true”); C. int i=1; int j=2; if(i=1| j=2) System.out.println(“OK”); D. int i=1; int j=2; if (i=1 答:BC 3、Which two demonstrate a “has a“ relationship(Choose two)? A. public interface Person public class Employee extends Person B. public interface Shape public interface Rectandle extends Shape C. public interface Colorable public class Shape implements Colorable D. public class Species 2 Copyright Tarena Corporation,2009.All rights reserved public class Animalprivate Species species; E. interface Component class Container implements Component private Component children; 答:DE 4、What will happen when you attempt to compile and run the following code? public class Static static int x = 5; static int x,y; public static void main(String args) x-; myMethod(); System.out.println(x + y + +x); public static void myMethod() y = x+x; A.compiletime error B.prints: 1 C.prints: 2 D.prints: 3 E.prints: 7 F.prints: 8 答:D 5、What is the correct ordering for the import, class and package declarations when found in a single file? A. package, import, class B. class, import, package C. import, package, class D. package, class, import 答:A 6、What will happen when you attempt to compile and run the following code. public class Pvf static boolean Paddy; public static void main(String argv) System.out.println(Paddy); 3 Copyright Tarena Corporation,2009.All rights reserved A. Compile time error B. compilation and output of false C. compilation and output of true D. compilation and output of null 答:B 7、Given the folowing classes which of the following will compile without error? interface IFace class CFace implements IFace class Base public class ObRef extends Base public static void main(String argv) ObRef ob = new ObRef(); Base b = new Base(); Object o1 = new Object(); IFace o2 = new CFace(); A. o1=o2; B. b=ob; C. ob=b; D. o1=b; 答:ABD 8、下面那几个函数是 public void method().的重载函数? A)public void method( int m). B)public int method(). C) public void method2(). D) public int method(int m, float f ). 答:AD 9、给出如下声明: String s = “Example”; 合法的代码有哪些? A)s=3 B)s3= “X” C)int i = s.length() D)s = s + 10 答:CD 10、如下哪些不是 java 的关键字? A)const B)NULL C) false D)this E) native 答:B 11、关于垃圾收集的哪些叙述是对的 A)程序开发者必须自己创建一个线程进行内存释放的工作 B)垃圾收集将检查并释放不在使用的内存 C)垃圾收集允许程序开发者明确指定并立即释放该内存 D)垃圾收集能够在期望的时间释放被 java 对象使用的内存 答:B 12、已知表达式 int m = 0,1,2,3,4,5,6; 下面哪个表达式的值与数组下标量总数相等? A)m.length() B)m.length C)m.length()+1 D)m.length-1 4 Copyright Tarena Corporation,2009.All rights reserved 答:D 13、方法 resume()负责恢复哪些线程的执行 A)通过调用 stop()方法而停止的线程。 B)通过调用 sleep()方法而停止的线程。 C)通过调用 wait()方法而停止的线程。 D)通过调用 suspend()方法而停止的线程。 答:D 14、有关线程的哪些叙述是对的 A)一旦一个线程被创建,它就立即开始运行。 B)使用 start()方法可以使一个线程成为可运行的,但是它不一定立即开始运 行。 C)当一个线程因为抢先机制而停止运行,它被放在可运行队列的前面。 D)一个线程可能因为不同的原因停止并进入可运行状态。 答:BCD 15、已知如下代码: public class Test long a = new long 10; public static void main(String arg ) System.out.print(a6); 请问哪个语句是正确的? A)Output is null. B)Output is 0 C)When compile, some error will occur. D)When running, some error will occur. 答:C 16、已知如下代码: public class Test public static void main(String arg ) int i = 5; do System.out.print(i); while(-i5); System.out.print(“finished”); 执行后的输出是什么? A)5 B)4 C)6 D)finished 5 Copyright Tarena Corporation,2009.All rights reserved 答:AD 17、已知如下代码: switch (m) case 0: System.out.print(“Condition 0”); case 1: System.out.print(“Condition 1”); case 2: System.out.print(“Condition 2”); case 3: System.out.print(“Condition 3”); default: System.out.print(“Other Condition ”); 当 m 的值为什么时能输出“Condition 2” A)0 B)1 C)2 D)3 E) 4 F)None 答:ABC 18、下面的哪些声明是合法的? A)long 1 = 4990 B)int i = 4L C)float f =1.1 D)double d = 34.4 答:AD 19、给出如下代码: class Test private int m; public static void fun() /some code 如何使成员变量 m 被函数 fun()直接访问? A)将 private int m 改为 protected int m B)将 private int m 改为 public int m C)将 private int m 改为 static int m D)将 private int m 改为 int m 答:C 20、以下哪个方法用于定义线程的执行体? A)start() B)init() C)run() D)main() E)synchronized() 答:C 21、请看如下代码 class Person private int a; public int change(int m) return m; public class Teacher extends Person public int b; 6 Copyright Tarena Corporation,2009.All rights reserved public static void main(String arg) Person p = new Person(); Teacher t = new Teacher(); int i; / point x 下面哪些放在/ point x?行是正确的? A i = m; B i = b; C i = p.a; D i = p.change(30); E i = t.b; 答:DE 22、给出下面的代码段: ( ) public class Base i
收藏 下载该资源
网站客服QQ:2055934822
金锄头文库版权所有
经营许可证:蜀ICP备13022795号 | 川公网安备 51140202000112号