95. Which of the following statements are true?
! g$ c8 ]# b& D& vA. For a given component, events will be processed in the order that the listeners were added
% ^8 ]9 @) P( C' k- S, N9 F* i% {& [B. Using the Adapter approach to event handling means creating blank method bodies for all event methods
0 a: U$ C% J. _ r6 FC. A component may have multiple listeners associated with it' d% Z- W2 [$ U, L- ~
D. Listeners may be removed once added2 x( {0 S9 A6 `6 [+ U% n+ S. i
CD.(maybe B) Not sure what they mean. If you code like this: class A extends MouseAdapter then class A will inherit all the methods in the MouseListener interface. And all of these methods will be empty. Of course these methods can later be overridden. Maybe some with english as their mother tongue can determine this. Button for instance has the methods addActionListener (ActionListener a) and removeActionListener(ActionListener a).5 x/ M( S) |- j) t1 y0 {7 P
96. Which of the following statements are true?/ ^, v9 o5 }. Z
A. Directly subclassing Thread gives you access to more functionality of the Java threading capability than using the Runnable interface3 g$ i7 Y0 t& ] q3 i( ~
B. Using the Runnable interface means you do not have to create an instance of the Thread class and can call run directly
8 f! Y; c9 F/ L8 \2 X; ?C. Both us ing the Runnable interface and subclassing of Thread require calling start to begin execution of a Thread
3 S% z' f, W% V) V5 s6 C1 R! b mD. The Runnable interface requires only one method to be implemented, this method is called run
v& b; H2 O, {$ U, T& eCD." D# v/ y2 C: @- s% V' D. F* U0 D
97. If you want subclasses to access, but not to override a superclass member method, what keyword should precede the name of the superclass method?' x" c" q# t Y! D* i. N
Answer:
7 ~( G `# s+ p1 E; n% cfinal3 Z. H+ t4 n) t8 M8 e! |7 A1 Y
98. If you want a member variable to not be accessible outside the current class at all, what keyword should precede the name of the
' b1 ^" c2 X8 t7 N X) d5 kvariable when declaring it?
. }; u( k; `$ R+ hAnswer:
+ v3 ]% l; R( g( Qprivate6 J: c V3 c6 k; C$ t
99. Which of the following are correct methods for initializing the array "dayhigh" with 7 values?
, V! I; s; L: `+ wA. int dayhigh = { 24, 23, 24, 25, 25, 23, 21 };
* O6 K2 u e/ q5 ]% y+ e+ o$ JB. int dayhigh[] = { 24, 23, 24, 25, 25, 23, 21 };) L7 V. y' d& G& M# U
C. int[] dayhigh = { 24, 23, 24, 25, 25, 23, 21 };
1 g! z. v2 w& R1 ]. Q, {D. int dayhigh [] = new int [24, 23, 24, 25, 25, 23, 21];
4 s U) `# d! M- J2 S( Z0 uE. int dayhigh = new [24, 23, 24, 25, 25, 23, 21] ;
$ h/ _& m, v9 W. O1 s. ]BC. |