a我考网

 找回密码
 立即注册

QQ登录

只需一步,快速开始

扫一扫,访问微社区

查看: 113|回复: 1

[考试试题] java认证试题:Java认证模拟题及分析(3)

[复制链接]
发表于 2012-8-4 12:33:16 | 显示全部楼层 |阅读模式
 question 29)   what is the result of the following operation?$ D( `" s: G! B
  system.out.println(4 | 3);! O* a; Y4 ~/ o; `5 t# b+ h
  1) 62 ^/ W* k$ J1 h+ y# w( Y. w9 \
  2) 0
$ H5 E  m) o, ?- o7 N  T$ j/ Z" |+ J% ?  3) 1. {) o& {( k. z
  4) 7
4 v: S) M9 z0 k: G  answer to question 29
( [8 ]. U3 ], \- N6 s  --------------------------------------------------------------------------------# g8 u8 s, p5 m. y
  question 30)! G3 _! g% L* X  ]) g3 q1 c* ~& }
  public class myclass1 {
1 Z7 M' a0 ]; C/ Q$ B+ m  public static void main(string argv[]){ }
1 a: z3 Q! |% \3 N, K+ m  /*modifier at xx */ class myinner {}
, L$ [" l/ P+ N4 [$ a  }6 Z! R: [7 T: C2 s8 G% f) l
  what modifiers would be legal at xx in the above code?
5 Z% J  W. ]3 D/ {- L( h  1) public
' _- G/ G+ R% Q( m( @% l! o2 ~  2) private9 }' A& q4 {! @* }7 G2 j
  3) static
. k" h: i1 B* E9 ~  `% x  4) friend
. @% n4 i1 |& e. x7 O6 D. D  I  answer to question 306 Z% \2 \4 P& @3 q( C
  --------------------------------------------------------------------------------
6 K* b# b, S5 E& Q" j: I7 U  question 31)
) Y( K& Y4 e9 c2 B& ^( U. Q  what will happen when you attempt to compile and run the following code?) H4 m2 @5 a! c; |& K+ |
  public class holt extends thread{
8 m. X& |$ A+ j* |/ a2 O  private string sthreadname;
6 A7 M. {' ]4 v+ I; A  public static void main(string argv[]){
3 H7 T  j: I; m$ p0 V. @& q  holt h = new holt();
( c: F0 o: Y6 S3 @0 \; C2 Y, X  h.go();
' L% D* \5 [2 s% M9 @$ Q4 r  }
3 ^% K( [+ q; f% j- x0 Z  holt(){}
9 |( K2 E' c3 T, J% _3 x' P2 ~  holt(string s){
. D, N1 C, F+ e+ E' `1 J  sthreadname = s;4 f- H# M5 F: U9 g( B8 U4 W; V

! h) L" z, Z3 }7 Q& R+ t' U; a  }
回复

使用道具 举报

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

java认证试题:Java认证模拟题及分析(3)

</p>  public string getthreadname(){
6 q5 T9 p) Y2 B$ O  return sthreadname;/ `% r+ c) q6 b0 D! S+ w+ j" y" a
  }$ g/ }& F' x7 q8 ~* v. j% S
  public void go(){
8 t9 ~8 x0 x6 k& D  holt first = new holt('first');
" q4 y! i- e) o( {  first.start(); ; e! h" O9 l  h7 F8 S- O5 Y

; o  q$ ]1 e+ e5 z  holt second = new holt('second');
% a& W. D4 Y  R8 |: F. V  second.start();
. C. P1 B0 G, j# ?' G4 \/ h# I. S6 L, b  }
  y9 ~$ |) ?4 d0 l6 X+ F  public void start(){; E1 e. r0 g6 O! F. n/ X
  for(int i = 0; i %26lt; 2; i ++){9 n6 ]% ~$ _& M0 Z1 r
  system.out.println(getthreadname() +i);
1 {! o- P: w/ q  try{; M2 D# n2 @' O
  thread.sleep(100);
' V+ C5 D# J9 Y7 X$ _; _  } catch(interruptedexception e){system.out.println(e.getmessage());}
  k' J2 Y# b! p2 e$ F- Y  }' q1 r; O: f: }) {" q
  }
) D; D. I4 @( t0 e( g4 P% b' W3 f  }
- C9 V, @' L. F  1) compile time error
; }0 D: A* p" l2 a  2) output of first0, second0, first0, second1
0 S" v+ i# @* A4 L' S0 n' [1 D  3) output of first0, first1, second0, second1
% _! H+ H0 [$ U0 z% H9 o- t' b  4) runtime error
3 {1 X+ w" T. c  answer to question 31
$ F( X% |9 j# _$ |$ e/ @3 H  --------------------------------------------------------------------------------
8 s5 J& A! h8 A- L& u: d- B* a  question 32)2 j% h1 @+ K. j, W; q! r. g
  an applet has its layout manager set to the default of flowlayout. what code would be correct to change to another layout manager.! {; E# [4 L2 _* e. B6 d' z8 r& w) T
  1) setlayoutmanager(new gridlayout());
) q9 h4 Q) e3 D( x4 X  2) setlayout(new gridlayout(2,2));
* ~% Q/ A1 j# Z" x, T! |% o1 |  3) setgridlayout(2,2);
# `  ], i, B( b) A3 |  Y  4) setborderlayout();
回复 支持 反对

使用道具 举报

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

本版积分规则

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

GMT+8, 2024-5-22 00:09 , Processed in 0.460483 second(s), 23 queries .

Powered by Discuz! X3.4 Licensed

© 2001-2017 Comsenz Inc.

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