a我考网

 找回密码
 立即注册

QQ登录

只需一步,快速开始

扫一扫,访问微社区

查看: 67|回复: 0

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

[复制链接]
发表于 2012-8-4 12:33:16 | 显示全部楼层 |阅读模式
4. Which statements are true about listeners?
, K% m/ Y' r1 R! l% mA. The return value from a listener is of boolean type.# [; l6 ^1 V0 C$ q: l$ S# K0 d
B. Most components allow multiple listeners to be added.
' _  Y$ T" U6 K. Y- u1 jC. A copy of the original event is passed into a listener method.
  v- }& I% x5 X& @1 vD. If multiple listeners are added to a single component, they all must all be friends to each other.
  J8 M. s0 B7 rE. If the multiple listeners are added to a single component, the order [in which listeners are called is guaranteed]., S. e5 J1 I8 H4 B, F
BC.
9 u' z# j6 x* D) \) C5. What might cause the current thread to stop executing.+ U. Z" R* l# J) A/ S
A.An InterruptedException is thrown.3 u) x4 ?1 n% ?. F' ?5 I! ]
B.The thread executes a wait() call.5 N* |( Q& \* d- k- D
C.The thread constructs a new Thread.
  W* r, K) T% l0 r: D( T, cD.A thread of higher priority becomes ready.
! Q5 r+ k% N1 n. l$ aE.The thread executes a waitforID() call on a MediaTracker.
* H8 |3 }0 z. [# e0 ]3 |1 fABDE.8 v% G4 S9 J$ P4 n+ p/ c# w
6. Given the following incomplete method.9 d5 d. X+ K; N" ]9 r, I# b! ~& Q
1. public void method(){
7 h2 R6 n+ U0 ~0 R! W# I0 `2.1 @+ o7 ^- l" B
3. if (someTestFails()){
# o! `) P5 A+ U$ y; C  @7 X4.+ x! P8 [7 G% R" Y' }. G
5. }
/ M, b% [& ^9 g: U& M. K6 {) `6.2 s, i; q' A5 J, O' I- ^
7.}9 \$ A1 _9 w0 V0 k$ d) R
You want to make this method throw an IOException if, and only if, the method someTestFails() returns a value of true.% z6 g5 @- w& D1 _/ I/ v
Which changes achieve this?7 M0 J2 s# `: R/ K" _' r1 {" W
A. Add at line 2: IOException e;6 X  G3 g  N1 \6 d- Y7 ?7 P4 Q4 x
B. Add at line 4: throw e;
. x( S' C" C: b( N4 I; gC. Add at line 4: throw new IOException();' ?% _7 g4 J% Q! K. Z& ?
D. Add at line 6: throw new IOException();
9 O0 C! [* C' X' {$ EE. Modify the method declaration to indicate that an object of [type] Exception might be thrown.
5 F0 B+ j5 O2 X* }7 I, hDE. (E suppose they mean the method declaration for someTestFails.)
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2024-5-19 05:25 , Processed in 0.530864 second(s), 21 queries .

Powered by Discuz! X3.4 Licensed

© 2001-2017 Comsenz Inc.

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