a我考网

 找回密码
 立即注册

QQ登录

只需一步,快速开始

扫一扫,访问微社区

查看: 140|回复: 0

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

[复制链接]
发表于 2012-8-4 12:33:16 | 显示全部楼层 |阅读模式
  Q70.What kind of stream is the System.out object?
$ X$ Z5 X* |: d3 F- U! {  a. java.io.BufferedWriter3 }8 L. O  |5 Z( A4 j
  b. java.io.PrintStream
; _+ E+ a+ \* w' G& }$ Z# S- o5 j  c. java.io.FileWriter
% q! O* x1 Q' M4 X/ \  d. java.io.OutputStreamWriter
% S9 z. w' G' `- n6 G) u! H, @  Q71.Which of the following events has a matching adapter class that implements the appropriate listener interface? Select all correct answers.& g/ S% f( Z- c$ S
  a. java.awt.event.MouseEvent
! b* w+ n8 m! s9 K1 {. r8 @  b. java.awt.event.ActionEvent
. K# p- {0 N$ G! q  c. java.awt.event.FocusEvent5 @+ `+ `/ {- @# T5 G# g' Y
  d. java.awt.event.ItemEvent
, w. W! }$ g* z8 E* S& _  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.
3 Y6 y3 P- o$ \% @) A% Q* _  M/ b# J  1. class Board extends Object {
+ \) \* f4 J% `4 g# f( X! i& J  2. Image[] pics = new Image[64];
% ~4 x$ P& ?+ a  3. int active = 0;
; s9 W# d! K7 g2 f. ~0 j9 s  4. public boolean addPic( Image mg, int pos) {/ @+ h6 K8 v, t' P5 N: H
  5. synchronized (this) {
- c3 a; B) ^" E/ A+ R  6. if (pics[pos] == null)' C+ s% k+ @( _$ ]/ Q
  7. { active++ ; pics[pos] = mg; return true; }
$ x% `. Q, G+ v. `* g  8. else0 t; Q. t. e2 I" w1 ?' r3 L; j
  9. return false;
; G& V) v% f& t/ V! n  10. }$ E* D0 U6 I6 s- l7 j
  11. }
% B% S5 R; h! T  12. // remainder of class
2 |! ~1 c$ |$ X8 |  h0 M, m  Select all the alternatives for line 5 that would accomplish this.& a& Y! G, A/ D9 @! Z  z
  a. synchronized (this)5 F8 o/ C1 U$ h. {
  b. synchronized (pics)( Y0 Y8 A: ?2 K2 r  [9 p
  c. synchronized (mg)
8 H. J& R" C/ ?! o9 L: P+ t; _  d. synchronized (active)& Y( d$ a, X& x6 e" r
  70. b* U! N; x- L- s7 J5 P* ^- I
  71. ac
* y/ E4 f  H4 k( N. Z! `: M  r  72. ab
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2024-5-22 05:04 , Processed in 0.321156 second(s), 21 queries .

Powered by Discuz! X3.4 Licensed

© 2001-2017 Comsenz Inc.

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