云南云电同方科技有限公司

上传人:第*** 文档编号:34056583 上传时间:2018-02-20 格式:DOC 页数:9 大小:263KB
返回 下载 相关 举报
云南云电同方科技有限公司_第1页
第1页 / 共9页
云南云电同方科技有限公司_第2页
第2页 / 共9页
云南云电同方科技有限公司_第3页
第3页 / 共9页
云南云电同方科技有限公司_第4页
第4页 / 共9页
云南云电同方科技有限公司_第5页
第5页 / 共9页
点击查看更多>>
资源描述

《云南云电同方科技有限公司》由会员分享,可在线阅读,更多相关《云南云电同方科技有限公司(9页珍藏版)》请在金锄头文库上搜索。

1、选择题 1: 1. What will be the result of executing the following code? 2. 3. public static void main(String args) 4. 5. char digit = a; 6. for (int i = 0; i 4) 3. System.out.println(“Test 1”); 4. else if (x9) 5. System.out.println(“Test 2”); 6. else 7. System.out.println(“Test 3”); 8. Which range of val

2、ue x would produce of output “Test 2”? A.x4 C.x9 D.None 3:关于垃圾收集的哪些叙述是对的。 A.程序开发者必须自己创建一个线程进行内存释放的工作。 B.垃圾收集将检查并释放不再使用的内存。 C.垃圾收集允许程序开发者明确指定并立即释放该内存。 D.垃圾收集能够在期望的时间释放被 java 对象使用的内存。 4: 1. Give the following method: 2. public void method( ) 3. String a,b; 4. a=new String(“hello world”); 5. b=new Stri

3、ng(“game over”); 6. System.out.println(a+b+”ok”); 7. a=null; 8. a=b; 9. System.out.println(a); 10. 11.In the absence of compiler optimization, which is the earliest point the object a refered is definitely elibile to be garbage collection. A.before line 5 B.before line 6 C.before line 7 D.before lin

4、e 9 5: 1. String s=”Example String”;Which operation is not legal? A.int i=s.length(); B.s3=”x”; C.String short_s=s.trim(); D.String t=”root”+s; 6:Which method you define as the starting point of new thread in a class from which new the thread can be excution? A.public void start() B.public void run(

5、) C.public void runnable() D.public static void main(String args) 7: Consider the class hierarchy shown below: - class FourWheeler implements DrivingUtilities class Car extends FourWheeler class Truck extends FourWheeler class Bus extends FourWheeler class Crane extends FourWheeler - Consider the fo

6、llowing code below: 1.DrivingUtilities du; 2.FourWheeler fw; 3.Truck myTruck = new Truck(); 4.du = (DrivingUtilities)myTruck; 5.fw = new Crane(); 6.fw = du; Which of the statements below are true? Choices: A.Line 4 will not compile because an interface cannot refer to an object. B.The code will comp

7、ile and run. C.The code will not compile without an explicit cast at line 6, because going down the hierarchy without casting is not allowed. D.The code will compile if we put an explicit cast at line 6 but will throw an exception at runtime. 8:Which statements about Java code security are not true?

8、 A.The bytecode verifier loads all classes needed for the execution of a program. B.Executing code is performed by the runtime interpreter. C.At runtime the bytecodes are loaded, checked and run in an interpreter. D.The class loader adds security by separating the namespaces for the classes of the l

9、ocal file system from those imported from network sources. 9:下面关于变量及其范围的陈述哪些是错的。 A.实例变量是类的成员变量。 B.实例变量用关键字 static 声明。 C.在方法中定义的局部变量在该方法被执行时创建 D.局部变量在使用前必须被初始化。 10: 1. Give the following java source fragement: 2. /point x 3. public class Interesting 4. /do something 5. 6. Which statement is correctly

10、 Java syntax at point x? A.public class MyClass/do other thing B.static int PI=3.14 C.class MyClass/do something D.none 11: 1. What will happen when you attempt to compile and run the following code? 2. 3. (Assume that the code is compiled and run with assertions enabled.) 4. 5. public class AssertT

11、est 6. 7. public void methodA(int i) 8. 9. assert i = 0 : methodB(); 10. 11.System.out.println(i); 12. 13. 14. 15.public void methodB() 16. 17.System.out.println(The value must not be negative); 18. 19. 20. 21.public static void main(String args) 22. 23.AssertTest test = new AssertTest(); 24. 25.tes

12、t.methodA(-10); 26. 27. 28. 29. A.it will print -10 B.it will result in AssertionError showing the message-“the value must not be negative”. C.the code will not compile. D.None of these. 12: 1. Give the following code: 2. public class Example 3. public static void main(String args ) 4. int l=0; 5. d

13、o 6. System.out.println(“Doing it for l is:”+l); 7. while(-l0) 8. System.out.println(“Finish”); 9. 10. 11.Which well be output: A.Doing it for l is 3 B.Doing it for l is 1 C.Doing it for l is 2 D.Doing it for l is 0 13:假定 a 和 b 为 int 型变量,则执行下述语句组后 ,b 的值为 a=1; b=10; do b-=a; a+; while (b-0); A.9 B.-2

14、 C.-1 D.8 14: 1. 1. public class X 2. 2. public object m () 3. 3. object o = new float (3.14F); 4. 4. object oa = new object 1; 5. 5. oa0= o; 6. 6. o = null; 7. 7. oa0 = null; 8. 8.return o; 9. 9. 10.10. 11.When is the float object created in line 3, eligible for garbage collection? A.Just after lin

15、e 5 B.Just after line 6 C.Just after line 7 D.Just after line 8(that is, as the method returns) 15: 1. What is the result when you compile and run the following code? 2. 3. public class ThrowsDemo 4. 5. 6. 7. static void throwMethod() 8. 9. 10. 11. System.out.println(Inside throwMethod.); 12. 13. throw new IllegalA

展开阅读全文
相关资源
相关搜索

当前位置:首页 > 办公文档 > 解决方案

电脑版 |金锄头文库版权所有
经营许可证:蜀ICP备13022795号 | 川公网安备 51140202000112号