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 |