a我考网

 找回密码
 立即注册

QQ登录

只需一步,快速开始

扫一扫,访问微社区

查看: 234|回复: 0

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

[复制链接]
发表于 2012-8-4 12:33:16 | 显示全部楼层 |阅读模式
  Q100 What is the value of 8|9&10^11?& y8 s& R; ]! Z( N7 F% U  w/ [+ ]
  A 8
/ Q' E) B! o8 M1 J: S# \  B 9
" g( T, c+ F3 L/ H  C 10) }2 h0 y* a* i
  D 11
, e, h9 t" \! w  Q101 What is the output of the following program?$ ?7 ^/ e3 w+ q- n' z/ V4 e8 V
  class S1 {' {+ y- W% Q3 v( |6 e
  public static void main(String [] args)
4 q, g4 N& w* H  {8 M2 L7 l4 Y  D
  new S2();
% N: b: }) Y, f+ y3 Q8 }  }
9 N/ E& s' h( @+ _: m, o+ x  S1() {$ ^, l9 O! Y4 q1 ]! E: t0 a
  System.out.print(“S1”);7 y6 g' H$ Y1 O# x+ }" o
  }
4 y" g( V: b6 Z9 A  }- S/ Z( S* T2 @: F7 c+ o
  class S2 extends S1 {1 V" t! {2 ]) O* G
  S2() {
9 l$ D9 y! }# E: D7 D' K6 f% S8 B9 j  System.out.print(“S2”);0 J' q- X9 x7 y- x4 d2 Q" }8 j
  }
+ C9 O/ l9 K, n  }
3 t* Z9 T. o6 M' v" @# C/ x# N. S5 I  A S1
: h2 R! ]+ R0 w: q6 Z  B S2- I- V  v+ D/ ~3 u# G- g
  C S1S2
: @8 ~  c8 g+ t% a" B  D S2S1( P( X# B4 a1 z  \, Z$ ~% r
  Q102 What would be the result of attempting to compile and run the following piece of code?
8 T2 U9 r: k7 \( E  }  public class Test {
7 e9 Y9 }7 o2 M! B8 _1 j. G  static int x;
. H' z3 V  j, V6 A  public static void main (String args[])
+ W) n% w/ Q1 v1 m  {2 K! ~$ ~4 B4 R$ r. R8 y
  System.out.println(“Value is “ + x);
1 p& X% ~; y- l5 I. e' V  }
# i/ g& Z! I8 t3 N  }& ?6 I: a0 Z0 l7 O4 j! S
  A The output “Value is 0 ” is printed.
* B1 F& h* `/ X) u1 q" p$ n  B An object of type NullPointerException is thrown.
. g& @/ e# k0 ?+ C& }# R7 K& Q  C An “illegal array declaration syntax” compiler error occurs.
1 g( o4 l' B* Y  y  D A “ possible reference before assignment” compiler error occurs.
+ K. W/ d, T7 u7 W  Q100 D
  e  S+ G1 f. S& z& R  Q101 C
. @  P; c+ {* [  Q102 A
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2024-5-21 11:15 , Processed in 0.243689 second(s), 21 queries .

Powered by Discuz! X3.4 Licensed

© 2001-2017 Comsenz Inc.

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