S1阶段测试.docVIP

  • 9
  • 0
  • 约 8页
  • 2017-05-23 发布于河南
  • 举报
S1阶段测试

一.选择题(每题2分,共40分) 1、给定下列代码:  if(x4){  System.out.println(Test 1); }else if (x9){  System.out.println(Test 2); }else {  System.out.println(Test 3); }  要使输出为Test 2,则x的范围是:  A.x4 B.x4 C.x9 D.不存在 2、main()方法的返回类型是? A. int B. void C. Boolean D. static E. Object 3、运行下列程序,输出为何? public class Qd803 { public static void main(String args[]) { String word = restructure; System.out.println(word.substring(2, 3)); } } A.est B.es C.str D.st E.s 4、代码System.out.println(+11+1); 的输出结果是: A.(空) B.11 C.12 D.111 5、十进制数16的16进制表示格式是____。 A、0x10 B、0x16 C、0xA D、016 6、对于垃圾回收机制(Garbage Collection)的说明,下面哪个叙述是正确的? A. 程序开发者必须编写线程来负责对内存空间的释放。 B. 垃圾回收机制会检查并释放那些不再需要使用的内存空间。 C. 垃圾回收机制允许程序开发者直接立即释放内存空间。 D. 垃圾回收机制可设定在预期的时间内释放被Java对象所使用的内存空间。 7、 有一个类(class)如下: 1. class Test { 2. void test(int i) { 3. System.out.println(“I am an int.”); 4. } 5. void test(String s) { 6. System.out.println(“I am a string.”); 7. }    8.    9. public static void main(String args[]) { 10. Test t=new Test(); 11. char ch=y; 12. t.test(ch); 13. } 14. } 针对上述Test类,以下的叙述句中,哪个是正确的? A. Line 5 will not compile, because void methods cannot be overridden. B. Line 12 will not compile, because there is no version of test() that takes a char argument. C. The code will compile but will throw an exception at line 12. D. The code will compile and produce the following output: I am an int. E. The code will compile and produce the following output: I am a String. 8、若要写出一个能将一组键(Key)与一组值(Value)结合的类,下述所列的接口(interface),哪个是最适用的? A. Map B. Set C. SortedSet D. Collection 9、运行下列程序,其输出结果为何? class Base { int i; Base() { add(1); } void add

您可能关注的文档

文档评论(0)

1亿VIP精品文档

相关文档