a我考网

 找回密码
 立即注册

QQ登录

只需一步,快速开始

扫一扫,访问微社区

查看: 90|回复: 0

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

[复制链接]
发表于 2012-8-4 12:33:16 | 显示全部楼层 |阅读模式
 Q85 If you ran the following program, which lines would be included in its output?   class Question {' H- X/ Q$ z% t; `
  public static void main(String[] args)/ ~/ A  v  r$ ?7 A
  {3 n3 v$ a. N4 F# M  _) B
  int i = 1;4 s, I; V$ u$ i5 N- ~9 {
  int j = 2;
& O$ v0 a2 h1 R8 N$ R9 c& t1 d7 t9 A  outer: while (i1 K3 _; ~' I3 g0 u. N0 F& u7 C; B, F
  ++i;
- B& p* T- l6 V+ n: s. e  inner: do {6 W, ~! A0 \7 X% i
  ++j;
/ r4 j3 ~; ?$ _% ~  if(i++ % 3 ==2) break inner;' O6 _: A8 z& ^5 P' }% \
  else if(j++ %3 ==1) break outer;1 B1 a$ s9 x! _" b# `! E
  System.out.println(i*j);4 f$ \# R, |' Z; L) \
  } while (j < i );! A* B) D8 S. s& N
  System.out.println(i+j);- G3 W6 m* g6 u$ v
  }: N) Q6 Z, s2 h% p- ]
  }6 Y" a/ Q7 f- K( i# I7 S6 w
  }) b# k. r. O4 }
  A 5
$ u: o0 o) G' v  B 6
. g( ^" K7 s0 f8 r1 ?% }- y  C 73 b8 g/ w$ Z/ f
  D The program does not display any output.
1 X) w7 c; I1 F- ^- K  h  D8 U/ L  Q86 What is the preferred way to handle an object’s events in Java 2?
) W; A# Q# D& K- T) C  A Override the object’s handleEvent() method.
/ o: b) `1 Y9 O6 o" c2 _9 v( l  B Add one or more event listeners to handle the events.
+ `) M' ~. W& g# r' O8 O7 l# ?  C Have the object override its processEvent() methods.
+ Y- H/ A9 k  Z+ }' V  D Have the object override its dispatchEvent() methods.( O9 B" P/ U& C) d1 I
  Q87 What is wrong with the following for statement?
, `1 H( M0 X1 ?6 z+ K
7 |& d/ K8 r/ j# I  for(i=0; j=0, i
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2024-5-21 09:38 , Processed in 0.322626 second(s), 21 queries .

Powered by Discuz! X3.4 Licensed

© 2001-2017 Comsenz Inc.

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