java认证试题:2011年JAVA认证模拟题(30)6 a8 H& n0 k: [: z P* x7 M6 K* }
Q88 What changes are needed to make the following program compile?
* t, }7 ~9 T5 P" H import java.util.*;
! M+ g+ k( S& S2 K3 ]8 H+ s class Question {
6 `7 j) T `8 q F8 T3 B9 t public static void main(String args[])
6 s, e+ U0 A; y2 B! Z/ ^6 V {
3 @; W0 |6 R6 c- b/ ~% f String s1 = “abc”;
3 T9 \; H5 H( K0 B4 m String s2 = “def”;# B" }7 b+ X \/ p
Vector v = new Vector();
" U' O7 J: @) @5 Z1 v2 b v.add(s1);
4 Z! O1 \( I% ? w! E v.add(s2);
4 t- l' u2 _2 d7 ~2 |, [ String s3 = v.elementAt(0) +
4 f9 u/ R- o+ y2 l# D% j v.elementAt(1);
, G3 m# M0 t) _0 ]5 L- G& s; E System.out.println(s3);/ c+ u* x' |( ]: y6 r7 \/ K9 a
}3 c, T" N3 E& |& s/ \9 l
}3 W, F6 I. q7 I% I
A Declare Question as public
. f8 r& A4 K" r% l" g: Q8 z B Cast v.elementAt(0) to a String
( ^2 Q' p2 n8 n% h! F$ b0 ?& Y C Cast v.elementAt(1) to an Object. x2 w1 J! U" u, |$ ~$ l
D Import java.lang3 i, H- J$ O- k; P9 ^0 f
Q89 What is the value of a[3] as the result of the following array declaration?& A9 u& U" a* N+ \, P
int [] a = {1,2,3,4,5};
1 L4 j5 ]6 T! k& v% |& h2 Z A 14 D+ V- Q5 c) b' g) Z8 Z
B 2
9 W& q! b+ r3 R2 J" }' | C 3/ c) ]7 W9 |& I' N
D 4
2 x$ C* j" ]4 G& W Q90 What Java statement is used to completely abort the execution of a loop?: z4 A5 @* g- V& Q8 ~
A The continue statement.$ E* o$ G2 l+ ?, |
B The goto statement
% v0 c3 j- q) c- _: b5 `/ w2 d+ o* a C The exit statement
5 ^) `3 N7 _- Q) k4 [; E D The bread statement+ c% @0 W5 o& j# Q
Q088 B
; f: W! Y/ O# k' z; T$ z1 |" Y* e Q089 D* @% Y' n1 K% \0 W/ u
Q090 D |