整理SCJP考试题-1

Java国际认证(SCJP)典型试题1000例 高清版 pdf Java国际认证(SCJP)典型试题1000例 高清版 pdf 作者: 施铮 出版社: 电子科技大学出版社 出版年: 2005-8 页数: 493 ISBN: 9787810948142 立即下载
<script type="text/javascript" src="http://pagead2.googlesyndication.com/pagead/show_ads.js"> </script> 例题1:   Choose the three valid identifiers from those listed below.   A. IDoLikeTheLongNameClass   B. $byte   C. const   D. _ok   E. 3_case   解答:A, B, D   点评:Java中的标示符必须是字母、美元符($)或下划线(_)开头。关键字与保留字不能作为标示符。选项C中的const是Java的保留字,所以不能作标示符。选项E中的3_case以数字开头,违反了Java的规则。   例题2:   How can you force garbage collection of an object?   A. Garbage collection cannot be forced   B. Call System.gc().   C. Call System.gc(), passing in a reference to the object to be garbage collected.   D. Call Runtime.gc().   E. Set all references to the object to new values(null, for example).   解答:A   点评:在Java中垃圾收集是不能被强迫立即执行的。调用System.gc()或Runtime.gc()静态方法不能保证垃圾收集器的立即执行,因为,也许存在着更高优先级的线程。所以选项B、D不正确。选项C的错误在于,System.gc()方法是不接受参数的。选项E中的方法可以使对象在下次垃圾收集器运行时被收集。  例题3:  Consider the following class:   1. class Test(int i) {   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. }   Which of the statements below is true?(Choose one.)   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 rakes 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.   解答:D   点评:在第12行,16位长的char型变量ch在编译时会自动转化为一个32位长的int型,并在运行时传给void test(int i)方法。   例题4:   Which of the following lines of code will compile without error?   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 &| j==2)   System.out.println(“OK”);   解答:B, C   点评:选项A错,因为if语句后需要一个boolean类型的表达式。逻辑操作有^、&、| 和 &&、||,但是“&|”是非法的,所以选项D不正确。   例题5:   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{ }   public class Animal{private Species species;}   E. interface Component{ }   class Container implements Component{   private Component[] children;   }   解答:D, E   点评: 在Java中代码重用有两种可能的方式,即组合(“has a”关系)和继承(“is a”关系)。“has a”关系是通过定义类的属性的方式实现的;而“is a”关系是通过类继承实现的。本例中选项A、B、C体现了“is a”关系;选项D、E体现了“has a”关系。   例题6:   Which two statements are true for the class java.util.TreeSet? (Choose two)      A. The elements in the collection are ordered.   B. The collection is guaranteed to be immutable.   C. The elements in the collection are guaranteed to be unique.   D. The elements in the collection are accessed using a unique key.   E. The elements in the collection are guaranteed to be synchronized   解答:A, C   点评:TreeSet类实现了Set接口。Set的特点是其中的元素惟一,选项C正确。由于采用了树形存储方式,将元素有序地组织起来,所以选项A也正确。 例题7:   True or False: Readers have methods that can read and return floats and doubles.   A. Ture   B. False   解答:B   点评: Reader/Writer只处理Unicode字符的输入输出。float和double可以通过stream进行I/O.   例题8:   What does the following paint() method draw?   1. public void paint(Graphics g) {   2. g.drawString(“Any question”, 10, 0);   3. }   A. The string “Any question?”, with its top-left corner at 10,0   B. A little squiggle coming down from the top of the component.   解答:B   点评:drawString(String str, int x, int y)方法是使用当前的颜色和字符,将str的内容显示出来,并且最左的字符的基线从(x,y)开始。在本题中,y=0,所以基线位于最顶端。我们只能看到下行字母的一部分,即字母‘y’、‘q’的下半部分。   例题9:   What happens when you try to compile and run the following application? Choose all correct options.   1. public class Z {   2. public static void main(String[] args) {   3. new Z();   4. }   5.   6. Z() {   7. Z alias1 = this;   8. Z alias2 = this;   9. synchronized(alias1) {   10. try {   11. alias2.wait();   12. System.out.println(“DONE WAITING”);   13. }     14. catch (InterruptedException e) {   15. System.out.println(“INTERR   UPTED”);   16. }   17. catch (Exception e) {     18. System.out.println(“OTHER EXCEPTION”);   19. }   20. finally {   21. System.out.println   (“FINALLY”);   22. }   23. }   24. System.out.println(“ALL DONE”);   25. }   26. }   A. The application compiles but doesn't print anything.   B. The application compiles and print “DONE WAITING”   C. The application compiles and print “FINALLY”   D. The application compiles and print “ALL DONE”   E. The application compiles and print “INTERRUPTED”   解答:A   点评:在Java中,每一个对象都有锁。任何时候,该锁都至多由一个线程控制。由于alias1与alias2指向同一对象Z,在执行第11行前,线程拥有对象Z的锁。在执行完第11行以后,该线程释放了对象Z的锁,进入等待池。但此后没有线程调用对象Z的notify()和notifyAll()方法,所以该进程一直处于等待状态,没有输出。   例题10:   Which statement or statements are true about the code listed below? Choose three.   1. public class MyTextArea extends TextArea {   2. public MyTextArea(int nrows, int ncols) {   3. enableEvents(AWTEvent.TEXT_   EVENT_MASK);   4. }   5.   6. public void processTextEvent   (TextEvent te) {   7. System.out.println(“Processing a text event.”);   8. }   9. }   A. The source code must appear in a file called MyTextArea.java   B. Between lines 2 and 3, a call should be made to super(nrows, ncols) so that the new component will have the correct size.   C. At line 6, the return type of processTextEvent() should be declared boolean, not void.   D. Between lines 7 and 8, the following code should appear: return true.   E. Between lines 7 and 8, the following code should appear: super.processTextEvent(te).   解答:A, B, E   点评:由于类是public,所以文件名必须与之对应,选项A正确。如果不在2、3行之间加上super(nrows,ncols)的话,则会调用无参数构建器TextArea(), 使nrows、ncols信息丢失,故选项B正确。在Java2中,所有的事件处理方法都不返回值,选项C、D错误。选项E正确,因为如果不加super.processTextEvent(te),注册的listener将不会被唤醒。 1.Which statement about the garbage collection mechanism are true?
SCJP题库 里面有certkiller和testkiller共500多道题<br>做完里面的题差不多就能过了,我考试的时候有20道左右的题目跟里面的一模一样 立即下载

相关推荐

scjp题库(中文版)

ocjp认证。适合有一定java基础的人看。里面的题比较偏重底层

java scjp 试题_JAVA认证历年真题:SCJP考试真题和解析

1. Which of the following range of short is correct?A.-27 -- 27-1B.0 -- 216-1C.–215 -- 215-1D.–231 -- 231-1翻译下面哪些是short型的取值范围。答案C解析 短整型的数据类型的长度是16 bits,有符号。另外需要说明的是java中所有的整(Integral)数(包括byte,short,in...

weixin_34184682的博客 926

JAVA认证历年真题

例题1:   Choose the three valid identifiers from those listed below.   A. IDoLikeTheLongNameClass   B. $byte   C. const   D. _ok   E. 3_case   解答:A, B, D   点评:Java中的标示符必须是字母、美元符($)或下划线(_)开头。关键字与保留字不能作为标示符。选项C中的const是Java的保留字,所以不能作标示符。选项E中的3_case以数字开头,违反了Java的规则。

java scjp 试题_JAVA认证:78道SCJP考试试题精解

JAVA认证:78道SCJP考试试题精解 QUESTION NO: 70 Which statement about static inner classes is true? A. An anonymous class can be declared as static. B. A static inner class cannot be a static member of the outer...

weixin_29617841的博客 545

scjp八套试题题库,看了绝对能上90分

scjp八套试题,看了绝对能上90分,背都要背下来

scjp试题

上面有很多试题,欢迎大家平分

SCJP考试题310-025(第一套)

google_ad_client = "pub-8800625213955058";/* 336x280, 创建于 07-11-21 */google_ad_slot = "0989131976";google_ad_width = 336;google_ad_height = 280;//<script type="text/java

java专栏 550

解密CANoe数据回放:从BLF到ASC的格式转换与优化策略

本文深入解析CANoe数据回放中BLF与ASC格式的转换与优化策略,帮助工程师高效处理汽车电子测试数据。详细介绍了两种格式的特性、转换方法及性能优化技巧,包括CANoe内置功能、命令行自动化和第三方工具应用,提升故障诊断和系统验证效率。

weixin_28331555的博客 538

Java测试错题集(4)

Java测试错题题解 博主声明: 本文由博主luoru_LR原创,请多支持与指教。 转载请在开头附加本文链接及作者信息,并标记为转载。 博主主页 下列选项中,不属于CSS3样式选择器的是( ) 正确答案:D A.empty选择器 B.root 选择器 C.target选择器 D.ID选择器 解析: 没明白题目意思。 以下代码执行的结果显示是多少( ) 正确答案:B public cl...

luoru的博客 668

一文带你弄懂thermal governor IPA

当current temp < target temp时,使用k_pu,当current temp >= target temp时,使用k_po。如果current_temperature = switch_on_temp时,则k_p = k_pu,这时Pmax。如果current_temperature = target_temp时,则k_p = k_po,这时Pmax。2、解析dts,获得switch_on_temp和target_temp。3、初始化k_pu/k_po/k_i/k_d的常数。

yxw0609131056的博客 1247

K8s认证文件丢失的应急处理与恢复策略

本文详细介绍了Kubernetes(K8s)认证文件丢失时的应急处理与恢复策略。从快速诊断问题范围到不同场景的临时解决方案,再到深度恢复方案(无损重建、部分重置、完全重建),提供了全面的操作指南。同时强调了生产环境中的防丢失设计、高可用集群的特殊处理以及日常运维建议,帮助运维人员有效应对认证文件丢失的紧急情况。

weixin_33743248的博客 327

Java认证考试心得:顺利通过SCJP测试全接触

来源:ChinaITLab 收集整理2004-5-17 11:09:00  Java以其平台无关性、,Java技术以其独特的优势对Java掌握的程度,参加Su绩通过了SCJP1.4的认证考面向对象、支持多线程等优点成在越来越多的领域得以使用和发n公司的Java认证考试是比较好试,有一些体会想与大家分享。为越来越多的程序开发

kiOm的专栏 4168

Pytorch实现EdgeCNN(基于PyTorch实现)

本专栏整理了《图神经网络代码实战》,内包含了不同图神经网络的相关代码实现(PyG以及自实现),理论与实践相结合,如GCN、GAT、GraphSAGE等经典图网络,每一个代码实例都附带有完整的代码。

优快云 精品推荐 1万+

java storedmap_SCJP模拟题

scjp模拟试题(一)Question No: 11.public class test (2. public static void main (String args[]) {3. int i = 0xFFFFFFF1;4. int j = ~i;5.6. }7. )What is the decimal value of j at line 5?A. 0B. 1C. 14D. –15E. A...

weixin_31319027的博客 1537

8.30华为OD机试真题 新系统 - 单词搜索计数 (Java/Py/C/C++/Js/Go)

8.30华为OD机试真题 新系统 - 单词搜索计数 (Java/Py/C/C++/Js/Go)

算法大师! 603

从零开始做对容量规划:一文讲透 SAP Greenfield sizing 与 Quick Sizer 落地方法

摘要 SAP项目早期硬件规划面临业务细节缺失的挑战,Greenfield sizing方法通过Quick Sizer工具将业务需求转化为硬件资源需求。该方法聚焦主要负载驱动因素而非精确预测,采用标准化问卷形式输入并发用户数、业务处理量等参数,输出内存、CPU等资源需求。关键步骤包括选择正确的Quick Sizer版本、创建sizing项目、参考SAP基准测试和认证目录校准结果,最终将需求交由硬件厂商落地。该方法特别适用于缺乏历史数据的新系统部署,帮助在不确定性中建立可控的容量规划模型,避免资源浪费或性能不足

2007 年 ~ 2025 年,深耕 SAP 技术 18 年 218

60道SCJP考试真题精解

60道SCJP考试真题精解 短整型的数据类型的长度是16 bits,有符号。另外需要说明的是java中所有的整(Integral)数(包括byte,short,int,long)全是有符号的。 Java的标识符可以以一个Unicode字符,美元符($)开始,下滑线(_),后续字符可以是前面的符号和数字,没有长度限制,大小写敏感,不能是保留字。 十六进制数以0x开头,long型数以L(大小写均可,一般使用大写,因为小写的l和数字1不易区分)。 String类型可以直接使用+进行连接运算。

u014447560的博客 686

国科大《人工智能原理与算法》2021年期末试题+2024经验(2025指南)

2021年期末试题+24年复习指南

MatsumotoChrikk 2930

Java基础笔试题(一)

本文主要介绍十道Java当中的笔试基础题,以及相关Java知识的补充。以及线程与is-a、has-a、like-a、use-a介绍。

张小鱼的博客 1199

MATLAB计算各种复合干热指数,如SDHI、DHMI等

MATLAB编程实现各种复合干热指数

WW、forever的博客 5082

Data-Structures-and-Algorithm-Analysis-in-Java.pdf

作者: Weiss, Mark A. 出版社: Addison Wesley Data Structures and Algorithm Analysis in Java is an “advanced algorithms” book that fits between traditional CS2 and Algorithms Analysis courses. In the old ACM Curriculum Guidelines, this course was known as CS7. This text is for readers who want to learn good programming and algorithm analysis skills simultaneously so that they can develop such programs with the maximum amo...

java scjp 试题_JAVA认证历年真题:SCJP考试真题和解析[1]

JAVA认证历年真题:SCJP考试真题和解析[1]例题1:choose the three valid identifiers from those listed below.a. idolikethelongnameclassb. $bytec. constd. _oke. 3_case解答:a, b, d点评:java中的标示符必须是字母、美元符($)或下划线(_)开头。关键字与保留字不能作为...

weixin_39854070的博客 931

复分析 阿尔福斯(Ahlfors) 第三版答案 英文

答案分为十章,有部分习题没有答案,全英文复分析阿尔福斯(Ahlfors) 第三版答案

SCJP认证试题(十一)

[code="java"] /** * * @author yaoyuan */ 10 package com.sun.scjp; 11 public class Geodetics{ 12 public static final double DIAMETER = 12756.32; //kilometers 13 } [/code] Which two corr...

J﹀行天下~ 471

ET2012新版免狗免安装绿色软件

ET2012新版免狗免安祖昂绿色软件。,新界面,新视觉,

SCJP考题14

615. Given the following class definition:public class Droitwich{class one {private class two{public void main(){System.out.println("two");}}}}Which of the following statements are

血色残阳的专栏 1464

java是学习方程!

过了SCJP,得分94%,自我感觉良好。下面把我自己的复习,考试过程在这里做个小结吧:      1.知识背景和概况:      我不是程序员,在大学做毕业设计的时候用Java系统,后来就没有再用过Java了,2001年的时候上过SCJP培训,讲得太快,那个钱算是浪费了。后来由于种种原因一直没考,今年终于下定决心把这个心愿了结了。到目前为止,我的水平只能算是业余的,但是我有信心很快就成能

u012661800的专栏 895
上一篇: SCJP考试题310-025(第一套)
下一篇: Spring中IOC的实现
java169
博客等级 码龄19年 27粉丝 2568原创
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

当前余额3.43元 前往充值 >
需支付:10.00元
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付元
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值