a我考网

 找回密码
 立即注册

QQ登录

只需一步,快速开始

扫一扫,访问微社区

查看: 110|回复: 1

[考试试题] 2011年JAVA认证模拟题(44)

[复制链接]
发表于 2012-8-4 12:33:16 | 显示全部楼层 |阅读模式
  Q130 Which of the following are true about an unreachable object?
7 T8 z) ^; Y( A9 t2 e  A It will be garbage collected.
1 d* C/ V, X8 w8 [7 w! C; {! B1 b- K% ?8 W  B Its finalize () method will be invoked.
' A- {" B1 G- D5 j6 U8 [6 p! k% L  C It can become reachable again.
& w/ e# b6 y' x  k7 n# Z  D It has a null value.
9 }' U) M6 d" U0 n  Q131 What is the value displayed by the following program?
) B$ @0 J; R0 J  class Question {' w& {6 j7 F8 U! m; p6 i
  public static void main (String[] args)
, M: O" P6 a8 l/ F# e  {
9 x- F5 n9 f3 q! `: x  int x = 0;4 J* E" ~5 k& ?
  boolean b1, b2, b3, b4;
  B' f5 N8 e! `7 {: x& @  b1 = b2 = b3 = b4 = true;* P% a; f% ^/ H2 n
  x = (b1 |b2 & b3 ^ b4) ? x++ : --x;
" A! R5 e6 a( Q% i5 d6 w& g( i9 b- F0 x3 o  System.out.println(x);1 P* D! n4 C3 m8 M
  }# a; a8 p1 J* L7 D0 i+ d$ z7 i- Q
  }6 `; a) b7 `+ I1 C  I# m; H
  A -1+ r) G/ }2 V; k7 _8 r
  B 0
$ ~* j9 M4 U' O! e1 f  C 1
0 d  N6 O- @# n# B' Y7 c* W4 I
6 H  s+ B) Y, h  D true
回复

使用道具 举报

 楼主| 发表于 2012-8-4 12:33:17 | 显示全部楼层

2011年JAVA认证模拟题(44)

</p>  Q132 What is the possible output of the following program?
; L/ x8 a* h5 o+ ~6 ~  import java.util.*;8 D  G' @( X6 T9 W: Q& S
  class Question {1 \) @; Y% E$ p5 Z+ e
  public static void main (String args[])
9 ~; S$ l, y' `5 C  {
, ]; Q5 [. p& [. j' _  HashSet set = new HashSet();
, Z, E$ O( w' G  String s1 = “abc”;8 K( @: `: G) Y; y6 [
  String s2 = “def”;) S' c% r0 {5 k4 ~. c! f  N" F
  String s3 = “”;
' g  E) R8 u6 M8 H* b2 ?4 J: d  set.add(s1);4 ^& D- T9 P8 V5 T) }
  set.add(s2);6 R8 t5 z  n! C9 s
  set.add(s1);
) h  G" i  t, V# q  set.add(s2);7 G1 |; o) v. u. b
  Iterator i = set.iterator();# H% Z8 V7 N" [1 Q- v
  while(i.hasNext()) {
1 z: d+ i! n; |2 S  s3 += (String) i.next();/ g2 p. i- `! Z$ O/ u, k
  }7 _6 C$ j, R) W( A& j/ }6 H
  System.out.println(s3);
# ~; Y0 P, ]7 t5 h" z6 G* \6 K  }  }6 U' M( x8 q$ G% z
  }
3 \6 v) y& K0 T8 w8 @( u  w; b  A abcdefabcdef. Y# _) a* F/ J" l2 `
  B defabcdefabc
5 V: K/ Q0 T! i5 F+ [, w  C fedcbafedcba4 ^$ b  A. ~% ?4 l" ?& _3 \& G5 ?
  D defabc
& {; N0 l( o, C4 L0 m3 R7 l  Q130 C. v. c' p, {) Q  [
  Q131 B% T! b1 B" U# q& ?9 i- b- x
  Q132 D
回复 支持 反对

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

Archiver|手机版|小黑屋|Woexam.Com ( 湘ICP备18023104号 )

GMT+8, 2024-5-18 03:15 , Processed in 0.240131 second(s), 23 queries .

Powered by Discuz! X3.4 Licensed

© 2001-2017 Comsenz Inc.

快速回复 返回顶部 返回列表