a我考网

 找回密码
 立即注册

QQ登录

只需一步,快速开始

扫一扫,访问微社区

查看: 140|回复: 2

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

[复制链接]
发表于 2012-8-4 12:33:16 | 显示全部楼层 |阅读模式
 Q 40 What is the output of the following program?   class Question {5 |) y1 g! ^" c" o$ w- c
  String s = “Outer”;$ F, L0 Z4 u% A. o/ l+ x4 E) W$ M
  public static void main (String [] args)
) I3 {% f4 r; c3 {9 f& @  {$ S/ s! A+ g' n/ p
  S2 s2 = new S2();) |  b0 z3 J: K; g) b1 [6 {
  s2.display();. k0 p$ f4 m( {4 a3 W+ s
  }
# p& n8 J% o3 L  }
1 m/ x* G, b- q% c$ P7 E' j! M  class S1 {
" H6 t1 I0 I" [; P' I  String s = “S1”;( m# z6 t$ f3 S. k& J7 i" O  O
  void display() {% s' V  X3 S! ]0 }/ Q5 j+ O
  System.out.println(s);
4 n0 p6 R' ^: b4 |7 s, a; ^  }
2 d; b! ^0 v4 Y2 B1 i  }
1 a6 {5 I. ?+ G; P( S" ?+ H' P/ z( M  class S2 extends S1 {
! F# V6 D2 k- l" c  String s = “S2”;
回复

使用道具 举报

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

2011年JAVA认证模拟题(14)

</p>  }
. a$ Z/ K9 G% P3 F  A S1) s' k- }8 o% R
  B S2/ M3 K( g( X0 n0 j" A; y
  C null4 J$ S* Q/ U) @4 F; i& s
  D Outer+ W  E4 V$ x8 r3 Z5 Y1 Q
  Q41 What is the output of the following program?
4 r$ f, P& r3 q& R1 l  class Question {0 z' h! r3 g  |  q( r
  static int i = 1;
" }* L, i$ f, |( _9 L  m, T( B% O  static {
: H$ P5 ?8 e3 W1 `9 \  ++i;" M5 h/ f4 g/ l
  }
+ F: n( k" o5 [0 ]3 o- ^  public static void main (String[] args)5 ^# Y# }- w! x
  {
& E9 ^- T& F9 ]3 H  p: `  increment (i, 5);
) }* R: k6 q  U: R+ M$ I3 }/ B. {  display(i);5 `: D8 }# m' w! [$ W1 d( V$ d$ d
  }* ?& _0 H: c1 z0 m( C' T
  static void increment(int n, int m) {
' ?' [  L# U6 n9 j# e  n+=m;  H% ~0 P5 |' h; e3 |
  }
5 x( |. _! R. p% {9 P. ?5 Y2 n3 \, w  static void display (int n) {
/ m. }7 X7 E1 U/ I  e" G9 K/ E  System.out.print(n);% A5 e$ s% |9 @, W1 W
  }
* C7 O* T" A. n& o: P1 Q, p, p5 Z
  static {
回复 支持 反对

使用道具 举报

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

2011年JAVA认证模拟题(14)

</p>  ++i;( N! H% I$ f: A0 J4 A' w
  }' i8 n, t7 o$ G& Y4 a" k0 x/ X
  }  h3 e: Y$ y4 E4 z$ O  T2 s/ ~
  A 1
/ @  ]) \& m) r2 C  B 3' k3 W0 P* l7 ~  l: ]+ t
  C 6
, j2 v- \- M5 B) P4 g  D 77 c) I9 I7 I/ l6 k6 Z' J( j+ ^( v
  Q 42 Which of the following are true?
" i# l$ O8 y; I  A A component may handle its own events by adding itself as an event listener.% Z# x+ K$ k+ P0 T
  B A component may handle its own events by overriding its event-dispatching method.! y3 m9 N, _& s" }
  C A component may not handle its own events.
5 y- o" S' X" r3 M  D A component may handle its own events only if it implements the h andleEvent() method.) F6 M' _( V; T7 Z
  Q040 A. W6 o$ p$ @' A/ g% h# E
  Q041 B
2 m( V& I* N0 @* |' T  Q042 AB
回复 支持 反对

使用道具 举报

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

本版积分规则

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

GMT+8, 2024-6-10 11:49 , Processed in 0.257295 second(s), 25 queries .

Powered by Discuz! X3.4 Licensed

© 2001-2017 Comsenz Inc.

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