a我考网

 找回密码
 立即注册

QQ登录

只需一步,快速开始

扫一扫,访问微社区

查看: 56|回复: 0

[考试试题] JAVA认证历年真题:310-025精选题(6)

[复制链接]
发表于 2012-8-4 12:33:16 | 显示全部楼层 |阅读模式
16. Consider the following code:
1 |; X( l& W' V+ ?) y/ hString s = null;* P) c4 R1 K; {6 c+ D3 h
Which code fragments cause an object of type NullPointerException to be thrown?: [9 K9 [  v# Z# O6 ^/ `5 t
A.if((s==null) & (s.length()>0))
" [! `0 p1 |8 `9 AB.if((s==null) &&(s.length()>0))
" Z, a; _3 Z7 f: k& n; G$ {# UC.if((s!=null) | (s.length()==0))! m0 q" K: U( [
D.if((s!=null) || (s.length()==0))
; Y9 R- v# d, T8 J4 b! aABCD.
0 t, _( ~! e  K5 f6 m. ~6 D17. Which statement is true about an inner class?& V$ U9 Z3 M& e5 g1 n
A. It must be anonymous* D9 Z5 |+ n+ ]# |! ?0 l0 e1 B3 g
B. It can not implement an interface  B2 A) \' u3 n
C. It is only accessible in the enclosing class2 @& R2 {$ F0 ?! E8 {
D. It can only be instantiated in the enclosing class
8 t; p; m" f$ V! ]/ OE. It can access any final variables in any enclosing scope.2 j3 H$ V8 Y. E" A/ a
E.
% u4 u; {4 S' p18. Which statements are true about threads?. Y  W+ l9 M+ k
A. Threads created from the same class all finish together3 u8 k$ O$ X! y# j  G
B. A thread can be created only by subclassing Java.Lang.Thread.9 T! H& F3 m6 d: r8 M
C. Invoking the suspend() stops a thread so that it cannot be restarted8 a1 M3 Z$ M0 z! V) W2 l
D. The Java Interpreter's natural exit occurs when no non daemon threads remain alive$ q# V" v9 S' q  _
E. Uncoordinated changes to shared data by multiple threads may result in the data being read, or left, in an inconsistent state.9 l) A" k( ?% D. l+ W& P6 E
DE.
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

Archiver|手机版|小黑屋|Woexam.Com ( 湘ICP备18023104号 )

GMT+8, 2024-5-19 06:15 , Processed in 0.166833 second(s), 21 queries .

Powered by Discuz! X3.4 Licensed

© 2001-2017 Comsenz Inc.

快速回复 返回顶部 返回列表