310-025精选题(39)的具体内容如下:
; r* k9 Z3 V$ M, d/ l9 y; R163. Which of the following statements about Java's garbage collection are true? A. The garbage collector can be invoked explicitly using a Runtime object.
' a# \% x$ D, M. E: cB. The finalize method is always called before an object is garbage collected.
. \# R- u. \( S2 G+ v% JC. Any class that includes a finalize method should invoke its superclass' finalize method.
6 g- X4 ]' N$ } O$ O& u% X+ {0 WD. Garbage collection behaviour is very predictable.& ^% p4 N, Q# p) b7 O
ABC.
, A& g l9 H! [1 B$ u+ h5 ^2 M164. What line of code would begin execution of a thread named myThread?
+ K# n G/ e7 r: |7 g! qAnswer:, g7 b9 w s+ m5 r1 j" k2 q
myThread.start();- o( W* Y& y, u2 X5 W6 }
165. Which methods are required to implement the interface Runnable?
) \8 M: }: R1 j5 B9 ~4 ]5 K" hA.wait()
0 P( m6 V. |% R8 ?B.run()
5 w! m. c/ Q3 u6 \C.stop(): u) |7 n( h) `* p
D.update()
. [" X, c) F7 K9 t7 R5 n6 vE.resume()1 m. L# P8 O( o6 ]" m j
B.
3 M! ?( b/ S) m q$ j1 B166. What class defines the wait() method?
. n5 d% T* s6 g. yAnswer:
- c+ ^6 ~! {: W. X% ]4 s4 l$ EObject.
' ~+ G }# [/ U6 `for yield(), sleep(#), start(), run() it is Thread
3 U* R3 b# y" n& {/ x) zfor wait(), notify(), notifyAll() it is Object
7 ]" |6 F0 U3 D( A167. For what reasons might a thread stop execution?9 R: X+ S4 d( p% w" X
A. A thread with higher priority began execution.
, l m+ Z' e7 `& U6 ^4 K7 Y WB. The thread's wait() method was invoked.) H% s6 b, A6 I0 x6 _% {1 J
C. The thread invoked its yield() method.
! K- m) G" K! I8 AD. The thread's pause() method was invoked.; ? y O9 g% l
E. The thread's sleep() method was invoked.8 `; `! Z' j# V5 N, K& W: M( }
ABCE. |