Q127 Given a component, comp, and a container, cont, that is organized according to a FlowLayout, which of the following should be used to add comp to the container.. [: i2 Q( H1 Q. o4 A
A cont.add(comp);
0 `9 b0 \' {7 S5 ?/ a6 G; B3 S B comp.add(cont);3 w1 `8 @6 r) l
C cont.addComponent(comp);
/ w6 s, s$ Z& X D cont.addAllComponents();+ [ d1 W9 h" o+ O% ~7 D
Q128 What is wrong with the following if statement?3 M, ^5 a$ l% H$ A6 u0 r$ G5 U
if(x++) {
! i0 u% j+ n: E, Q9 r, E4 O. { y = x * z;, q8 y' _6 l5 C
x /=2;
$ k" q& g i5 O0 g3 W, G) T5 F else {" o& F; f7 v, J1 M5 j8 M
y = y * y;8 r+ D. t# _7 _ [+ f5 N
++z;
* X+ [! n6 @/ f! U' Y }+ z4 I( L" O/ z% w0 k
A The if condition should use a prefix operator instead of a postfix operator. ]6 A; {' L2 d) @( A0 C6 _
B The if condition must be a boolean expression, not a numeric expression- x0 n/ f' N# a1 N) o5 u
C There is a missing } before the else.
5 F+ g( A: G$ P8 }: o D There is no break statement to allow control to transfer out of the if statement.* o1 e2 F& [8 e6 A& W l1 @7 N% ~
Q129 Which of the following are true?
/ R2 G. a3 W4 G% \* A, c' D/ d A The event-inheritance model has replaced the event-delegation model.( d/ I4 Y' `# k
B The event-inheritance model is more efficient than the event-delegation model.中 华 考 试 网
$ d. t/ P! O! u( X5 I% L C The event-delegation model uses event listener to define the methods of event-handling classes.
1 \8 |% E# H7 {3 i& S! Z. u D The event-delegation model uses the handleEvent() method to support event handling.' M2 ]$ Y8 N1 L7 T6 L( M
Q127 A
3 A1 q c0 q4 f8 u Q128 BC
) ^" n( q0 j" O; z# _% m* @. u Q129 C |