</p> Q2.Here is a method which creates a number of String objects in the course of printing a count down sequence.7 }" ]8 W: F0 M* P8 @
1. public void countDown() {& [% i2 o0 k+ a# ^& G7 E
2. for( int i = 10 ; i >= 0 ; i-- ){4 I# V2 X" j( T2 w
3. String tmp = Integer.toString( i );
" i2 E* I" ]' ^ 4. System.out.println( tmp );
9 F, Q9 t, n( Z" P 5. }
; K; ]' \2 k, s; p% N 6. System.out.println(“BOOM!”);
+ m2 C; S! T. u" E4 E 7. }/ H; S9 _# Z% a Q/ M9 N
When the program reaches line 6, how many of the String objects created in line 3 are eligible for garbage collection? Assume that the System.out object is not keeping a reference.. z; M) o2 V: Y( k2 l
a. none
8 T; F% l2 \9 f b. 1
7 \& B# c3 w9 ]7 p c. 104 \" J0 l: Y: ^5 u
d. 119 {7 s$ j# W+ h; M
Q3.Select all of the following methods that are instance methods of the Thread class, excluding any methods deprecated in Java 1.2.' K: [% B8 O. n& X& i
a. start()8 d* P+ k/ b. [5 J9 d
b. stop()3 K: m( X( c) b g( H
c. run()
) E5 W% {( Q7 K# U( _ d. suspend()3 p) \5 [ `' H$ V
e. sleep( long msec )* \) H @9 q" @$ h( D, ^9 ~( f
f. toString()
f1 ~4 T6 Z% G, J" p 1. bd
% {! N& `4 t$ c$ B C 2. c) y5 C1 ?# @. m; X
3. acf |