a我考网

 找回密码
 立即注册

QQ登录

只需一步,快速开始

扫一扫,访问微社区

查看: 100|回复: 1

[考试试题] 2011年JAVA认证模拟题第二阶段(11)

[复制链接]
发表于 2012-8-4 12:33:16 | 显示全部楼层 |阅读模式
  Q31.What will appear in the standard output when you run the Tester class?& k: I" m" }8 D6 }4 ^4 V
  1. class Tester {5 }1 y& a: H+ D5 R6 n
  2. int var;
: N1 r4 ?5 k. \, ~+ H  3. Tester(double var) {
" B# p. I1 M; z2 u7 P2 W, h* M, m6 Y  4. this.var = (int)var;& j& z+ r% V1 n! L
  5. }
9 Y( b5 z6 n6 r1 K6 @, m5 j  6. Tester(int var) {
9 p  F+ Z' o1 O$ O" h0 |1 Y# h  7. this(“hello”);6 U& Q+ L7 }7 [0 X) {: b
  8. }
- _  v$ ^) w- f5 S  9. Tester(String s) {
) o* g5 E8 ]+ w8 b- F9 b  10. this();5 {% M; Z8 Z* T# S* `$ {
  11. System.out.println(s);
, K, T' M. U! t+ x. }+ f$ F  12. }6 H8 }2 T- [6 j- M* L7 W
  13. Tester() {) `3 \( E1 g$ t0 {. l5 K* D! @4 l
  14. System.out.println(“good-bye”);/ x0 g( b' d2 J6 |1 i
  15. }7 Z5 {/ d" f- ^  l) D1 S, V
  16. public static void main(String args[]) {6 o/ e( f1 d6 L, x9 {2 e6 l
  17. Tester t = new Tester(5);
9 b: J; \8 G  z  18. }, I7 ^3 f6 b$ K. o4 N8 ^
  a. “hello”' V. h1 ^. J( s" V/ W( ~( v; Q5 g1 F
  b. 51 r% {( N8 V' T1 \) B
  c. “hello” followed by “good-bye”
& E* D5 L1 e" ?  P6 \
4 ^/ I/ D0 {" z- l  d. “good-bye” followed by “hello”
回复

使用道具 举报

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

2011年JAVA认证模拟题第二阶段(11)

</p>  Q32.What are the range of values for a variable of type short?( K& a8 m$ n- i' j
  a. -2^7 to 2^7-1
4 J2 Q& g3 ^( D; `; ]  b. 0 to 2^8
2 c% a4 Q% c1 V5 F6 s/ t  c. -2^15 to 2^15-1, I6 F3 {# s2 r% |3 F
  d. -2^15-1 to 2^15
3 ~& Z* ]8 u& i( [5 D  Q33.Analyze the following two classes; X; w6 ]3 O/ z. E- s- @
  1. class First {' v$ J  R8 l2 W% E+ V
  2. static int a = 3;
1 L5 r% U( E7 ?  3. }
- n5 H0 _, p6 Y& o! T# \3 {7 W& j& s  4. final class Second extends First {
- X& c2 E( q2 e5 a3 R3 U0 C  5. void method() {
! W( m& j, y5 T6 O7 R/ Z$ b  6. System.out.println(a);1 n! t0 C1 a: y$ g& }% \- Y5 r
  7. }+ k% M8 q& K! a7 S; f* h
  8. }
8 h; ?( v% R3 G6 f& {  a. Class First compiles, but class Second does not.
& J5 i2 Z- {3 }  b. Neither class compiles.! e' D! t& A) S, J
  c. Both classes compile, and if method() is invoked, it writes 3 to the output.
" r! n8 Q8 c- d9 [: a) b0 ~  d. Both classes compile, and if method() is invoked, it throws an exception.
5 R0 ]6 ~( c) ]9 p( t9 O  31. d- ?; H6 _4 O" ~
  32. c
( R5 `6 W/ G4 K  33. c
回复 支持 反对

使用道具 举报

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

本版积分规则

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

GMT+8, 2024-5-17 21:11 , Processed in 0.432464 second(s), 23 queries .

Powered by Discuz! X3.4 Licensed

© 2001-2017 Comsenz Inc.

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