a我考网

 找回密码
 立即注册

QQ登录

只需一步,快速开始

扫一扫,访问微社区

查看: 141|回复: 0

[考试试题] 2011年JAVA认证模拟题第二阶段(24)

[复制链接]
发表于 2012-8-4 12:33:16 | 显示全部楼层 |阅读模式
  Q70.What kind of stream is the System.out object?
( t3 b( D  E, L  a. java.io.BufferedWriter5 o* U. B, E0 j+ l/ L
  b. java.io.PrintStream
" u; X0 m3 K/ n1 w; t" K" o2 a3 X  c. java.io.FileWriter3 [+ F. v5 V- ~. L4 G" i
  d. java.io.OutputStreamWriter1 v& ]+ r8 Y( i1 r6 v/ C
  Q71.Which of the following events has a matching adapter class that implements the appropriate listener interface? Select all correct answers.( t/ h, G6 b7 a4 W
  a. java.awt.event.MouseEvent( U8 D7 v! P7 J4 j/ R
  b. java.awt.event.ActionEvent
* S4 O3 }, y1 \) ?  c. java.awt.event.FocusEvent/ s" |# C! b7 f4 p
  d. java.awt.event.ItemEvent
) m! m% I# i7 ]  Q72.Here is a partial listing of a class to represent a game board in a networked game. It is desired to prevent collisions due to more than one Thread using the addPic method to modify the array of Image references.5 A. K; |1 R- Q
  1. class Board extends Object {$ |/ L3 x1 |% ~" d4 @
  2. Image[] pics = new Image[64];
3 D9 {7 D* u# l  3. int active = 0;) _5 D% g8 }  b" S# O& H4 r) ]( |
  4. public boolean addPic( Image mg, int pos) {
* l0 r' k% |5 z# c3 ]  5. synchronized (this) {6 i/ ]/ p- s9 p: x: g& M! N
  6. if (pics[pos] == null)5 O$ `' `% s. T) M2 Q6 ?9 g$ @
  7. { active++ ; pics[pos] = mg; return true; }
+ W& h  `+ i& f6 P6 \8 ]  8. else
* Q% B+ E; I( u* m. k  9. return false;
2 V& _3 \$ Y5 L" y8 X- V  10. }) R( o, k! f# s. g* g
  11. }
8 x) l6 h4 o- D1 G  12. // remainder of class0 n" M2 ~9 N# ~% ~+ O
  Select all the alternatives for line 5 that would accomplish this.' j- y- C8 c. W$ H/ r
  a. synchronized (this)
3 }% ^+ V( _) z! E  b. synchronized (pics)
  |0 T" P9 |8 q  c. synchronized (mg)4 C! x" X6 a5 l2 z; H
  d. synchronized (active)
! S; [/ m: e2 i1 Y) w( C1 U/ x! z  70. b# f' }/ X2 {+ I0 [# D$ [' n" k7 p7 C8 I
  71. ac
' R# }4 e, B' q  72. ab
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2024-6-2 12:29 , Processed in 0.288962 second(s), 22 queries .

Powered by Discuz! X3.4 Licensed

© 2001-2017 Comsenz Inc.

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