已阅读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. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。
最新文档
- 长春市宽城区2025届三年级数学第二学期期末质量跟踪监视模拟试题(含答案解析)
- 房地产销售工作小结范文
- 精准医疗大数据的跨境安全流动风险阻断与跨国药企全球分工下研发要素安全路径-基于跨境数据流动安全评估办法在基因治疗与罕见药研发领域
- 万顺新材首次覆盖报告:产能扩充夯实根基盈利拐点确立
- 刘禹锡《秋词》课件
- 交通运输行业2026年中期投资展望:继续押注高确定性并关注底部反弹机会
- 某家具公司木材烘干规范
- 某汽车厂装配质量规范
- 有机无机面试题及答案
- 净化师面试题及答案
- 2026年市场监管取证方法练习题
- 非标自动化电气设计流程及规范
- 2024年家庭照护赛项竞赛样题及评分标准、设施设备物品清单
- 加油站防雷责任制度
- 2025年山西电子科技学院马克思主义基本原理概论期末考试模拟题含答案解析(必刷)
- 宫腔镜空气栓塞课件
- 大型采购招标项目管理和风险控制方案
- 人教部编版道德与法治七年级下册期末试卷
- 2023年暨南大学公共课《马克思主义基本原理概论》期末试卷B(含答案)
- 云南省2025年7月普通高中学业水平合格性考试语文试题(含答案解析)
- VSD负压引流技术临床应用与规范化护理流程指南
评论
0/150
提交评论