a我考网

 找回密码
 立即注册

QQ登录

只需一步,快速开始

扫一扫,访问微社区

查看: 114|回复: 1

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

[复制链接]
发表于 2012-8-4 12:33:16 | 显示全部楼层 |阅读模式
 question 29)   what is the result of the following operation?
  R! G8 F0 ]8 ~  system.out.println(4 | 3);
; n7 j& B( W" r- q# N* K9 q/ Y  1) 66 ]1 D6 b+ h% w) }" r1 v* }: w
  2) 0: ^& r* c/ C) ^& M9 S4 T! v  I# M( Y  Z
  3) 1- L: h, S+ K5 E8 Y
  4) 7
* i) D: Y6 u/ F2 `  answer to question 29
: n$ _2 v* h& `+ A! G  --------------------------------------------------------------------------------5 e3 Q( v6 P0 B7 _7 {" b0 y4 t
  question 30)
; M; f7 J' |' l& G  public class myclass1 {
) u9 p( B5 R3 k2 ~. E, \1 h# z  public static void main(string argv[]){ }1 W; y5 @( j5 p! x; W2 Y
  /*modifier at xx */ class myinner {}
/ \- c7 K" h4 e& V: S+ w: `2 G  }7 D& {+ _8 W. g$ Q$ o
  what modifiers would be legal at xx in the above code?
+ j5 i2 ^7 U) m& v! o, v3 o8 X6 `  1) public
$ B; f  n# @% ~% j  2) private
3 I; j+ K, V0 Z, n% o) V. e  i  3) static
' u) d. ~( j5 E9 w" e* E( n* [  4) friend
+ r# v6 s) l/ P% _  answer to question 30
5 ?3 ~5 O7 M% C  --------------------------------------------------------------------------------
: N& ^8 I  T; F! ~4 D# f$ n* [  question 31)* H* \$ b0 `: c
  what will happen when you attempt to compile and run the following code?
3 {5 w) |8 q* N7 n9 h1 d  public class holt extends thread{5 b$ z- D4 r! t5 C5 K/ i$ H4 }
  private string sthreadname;  d# A% M3 B. Z$ u: _' i
  public static void main(string argv[]){2 b$ ]$ P) h1 S/ e- m8 X% E- y! C
  holt h = new holt();0 {  }* X2 ^/ |; d# K( u
  h.go();- ]$ t8 K' D4 Y
  }
' K! Y, q% ~: M" h- k  holt(){}
6 v# e5 e5 I+ Q% T: M6 N" y  holt(string s){
7 E4 w# p/ D, A; R9 J  sthreadname = s;! f3 h: V# t& f% v2 ?( A6 Z

, I, L5 b  y  o* _7 s  }
回复

使用道具 举报

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

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

</p>  public string getthreadname(){
: c0 C- I6 `; m' X9 k( D  return sthreadname;
0 r+ l+ P& Z# e# T* S8 d  }0 G3 x4 v& Z7 R; B. p
  public void go(){3 ], n, C0 b) h' {0 Y; S$ e0 k
  holt first = new holt('first');
* O. j* k! [7 L! a+ ?  first.start(); , \( `/ X+ _' p# Q+ R' x
# M# M2 u' e7 n. K# X- G9 q1 a
  holt second = new holt('second');
* S  o7 O, G9 y  second.start();( Z' r3 [& N" K' k+ K
  }
0 g/ ^8 A3 k' v4 N, |. z- `( D  public void start(){
1 q  _/ ?. _" w; k! z  for(int i = 0; i %26lt; 2; i ++){0 F2 x0 B! t8 `
  system.out.println(getthreadname() +i);
4 M6 e: b4 p" a7 |  try{
7 T8 X! [2 |+ f2 i  thread.sleep(100);
# C0 w+ |; B+ l! @4 d  } catch(interruptedexception e){system.out.println(e.getmessage());}1 V5 l* a7 c+ w
  }
3 g* W/ x9 B& r6 F9 Z' R  }
- t2 r  N* a, i; D9 r  }
. w8 |: _; y& m3 G! M  1) compile time error
  i1 H4 y) V# |- h! Z% c  2) output of first0, second0, first0, second12 m: I$ m: L* X( j2 s! Z
  3) output of first0, first1, second0, second1) j  o) y0 }" u
  4) runtime error" c1 g& l/ `2 m/ ]& n9 @: I
  answer to question 31
! |. ~/ M% P) `6 H2 Q  --------------------------------------------------------------------------------
4 O: @+ Y- O9 A  question 32)
8 u: L% f- w9 Z' ^! u  an applet has its layout manager set to the default of flowlayout. what code would be correct to change to another layout manager.
' @2 W. p9 r! c' k) ?/ D  1) setlayoutmanager(new gridlayout());: V7 G+ ]* O6 L2 i: q. l$ R
  2) setlayout(new gridlayout(2,2));$ v3 {' Z7 Z( q
  3) setgridlayout(2,2);$ ?: n) t( Q0 `; z* F0 ^3 g
  4) setborderlayout();
回复 支持 反对

使用道具 举报

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

本版积分规则

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

GMT+8, 2024-6-3 07:03 , Processed in 0.263778 second(s), 23 queries .

Powered by Discuz! X3.4 Licensed

© 2001-2017 Comsenz Inc.

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