已阅读5页,还剩2页未读, 继续免费阅读
版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领
文档简介
1:A class design requires that a member variable should be accessible only by same package, which modifer word should be used? A.protected B.public C.no modifer D.private 2:What will happen when you attempt to compile and run the following code? public class Staticstaticint 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; Choices:A.prints : 2 B.prints : 3 C.prints : 7 D.prints : 8 3:What will be the result of executing the following code? public static void main(String args) char digit = a; for (int i = 0; i 10; i+) switch (digit) case x : int j = 0; System.out.println(j); default : int j = 100;System.out.println(j); int i = j; System.out.println(i); Choices:A.100 will be printed 11 times. B.The code will not compile because the variable i cannot be declared twice within the main() method. C.The code will not compile because the variable j cannot be declared twice within the switch statement. D.None of these. 4:Which fragments are not correct in Java source file? A.package testpackage; public class Test/do something. B.import java.io.*; package testpackage; public class Test/ do something. C.import java.io.*; class Person/ do something. public class Test/ do something. D.import java.io.*; import java.awt.*; public class Test/ do something. 5:下述程序代码中有语法错误的行是( )。int i,ia10,ib10; /*第一行*/for (i=0;i=9;i+) /*第2行*/ iai=0; /*第3行*/ib=ia; /*第4行*/A.第1行 B.第2行 C.第3行 D.第4行 6: Which of the following statements are true? A.The automatic garbage collection of the JVM prevents programs from ever running out of memory B.A program can suggest that garbage collection be performed and force it C.Garbage collection is platform independent D.An object becomes eligible for garbage collection when all references denoting it are set to null. 7:Select valid identifier of Java:A.%passwd B.3d_game C.$charge D.this 8:Math.round(-11.5)等於多少? A.-11 B.-12 C.-11.5 D.none 9:What results from attempting to compile and run the following code? public class Ternarypublic static void main(String args)int a = 5;System.out.println(Value is - + (a 5) ? 9.9 : 9); Choices:A.prints: Value is - 9 B.Compilation error C. prints: Value is - 5 D.None of these 10:Which is the main() method return of a application? A.String B.byte C.char D.void 11:In the following code, which is the earliest statement, where the object originally held in e, may be garbage collected: 1.public class Test 2. public static void main (String args ) 3. Employee e = new Employee(Bob, 48); 4. e.calculatePay(); 5. System.out.println(e.printDetails(); 6. e = null; 7. e = new Employee(Denise, 36); 8. e.calculatePay(); 9. System.out.println(e.printDetails(); 10. 11.Only One: A.Line 10 B.Line 11 C.Line 7 D.Line 8 12:Give this class outline:class Exampleprivate int x;/rest of class bodyAssuming that x invoked by the code java Example, which statement can made x be directly accessible in main() method of Example.java?A.Change private int x to public int x B.change private int x to static int x C.Change private int x to protected int x D.change private int x to final int x 13:以下的C程序代码片段运行后C和d的值分别是多少 Int a =1,b =2; Int c,d; c =(a&b)&a; d =(a&b)&a; A.0,0 B.0,1 C.1,0 D.1,1 14:假定a和b为int型变量,则执行下述语句组后,b的值为 a=1; b=10; do b-=a; a+; while (b-0); A.9 B.-2 C.-1 D.8 15:Math.round(11.5)等於多少? A.11 B.12 C.11.5 D.none 简答题 16:Hashtable和HashMap的异同。 17:用 100 元钱买 100 支笔,其中钢笔 3 元 / 支,圆珠笔 2 元 / 支,铅笔 0.5 元 / 支,问钢笔、圆珠笔和铅笔可以各买多少支 ? 18:tomcat中,什么是DefaultServlet?他的功能是什么? 19:一个类只有实现了Serializable接口或者Externalizable接口,它的对象才可以被序列化。请问,这两种序列化机制有何区别? 20:char型变量中能不能存贮一个中文汉字?为什么? 21:字符串A是由n个小写英文字母(a z)构成的,定义为char An。你能用更少的空间
温馨提示
- 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
- 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
- 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
- 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
- 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
- 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
- 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。
最新文档
- 护理质量月团队协作
- 湖北省2026年5月高三下学期高考前壮行考试语文试卷
- 2026年湖北武汉市2026届高三第三次模拟考试语文试题及参考答案新版
- 护理实践中的妇产科护理
- 机电点检员笔试试题及答案
- 船台总装全过程管控方案
- 厂区道路工程施工组织方案
- 市政管道环保降尘施工方案
- 输电线路设备采购限额方案
- 氢氧化铝检修维护实施方案
- 污水站安全操作应急处置培训考试题及答案
- 牵引供电培训课件
- 2025年重庆红色旅游市场调研报告
- CJ/T 288-2008预制双层不锈钢烟道及烟囱
- 东航总部劳务派遣合同6篇
- 外厂人员驻厂安全协议书
- 加油站资产价值评估报告
- s和m关系协议书
- 企业民法典宣讲课件
- GB/T 19405.3-2025表面安装技术第3部分:通孔回流焊用元器件规范的标准方法
- 国家开放大学2025年《机电控制工程基础》形考任务1-4答案
评论
0/150
提交评论