a我考网

 找回密码
 立即注册

QQ登录

只需一步,快速开始

扫一扫,访问微社区

查看: 112|回复: 1

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

[复制链接]
发表于 2012-8-4 12:33:16 | 显示全部楼层 |阅读模式
  question 1)
5 j% R7 }  l* P  which of the following lines will compile without warning or error.
, L- t/ a( ^- ^  c( m  1) float f=1.3;( a( x! N0 ~* A
  2) char c='a';
" X, S7 b4 d: d  3) byte b=257;
% D$ b0 f& z% [2 z# n) H  4) boolean b=null;
5 D6 `5 N, ?5 X  5) int i=10;
4 ]5 p9 F1 \4 `. M! E7 r" W  answer to question 15 {/ l2 z6 I( P+ i" U6 d2 q% J
  --------------------------------------------------------------------------------
4 o5 Z4 C- m& N  question 2)1 O2 ]1 G+ k4 G0 H: o
  what will happen if you try to compile and run the following code" Q+ s! e1 P4 ]' U4 S* [0 d
  public class myclass {
7 R1 E6 N/ A+ E0 Y) z1 @  public static void main(string arguments[]) {: R  N( y: D# v9 E" y; _0 u  E! s
  amethod(arguments);5 i# P' n& x) ^1 U; M
  }1 r; |/ W( h' W/ j5 m$ I
  public void amethod(string[] arguments) {% ?/ O1 D& ^7 L' E9 ~, W
  system.out.println(arguments);
4 r8 |0 x$ w5 k; C& f  system.out.println(arguments[1]);
& p# v: U4 n! S8 y4 z) ^! y  }: M! t" s" h5 P& h
  }7 |* R$ d4 I1 R1 t+ L: [& v
  1) error can%26acute;t make static reference to void amethod.1 e: H* V- J! D2 u
  2) error method main not correct
6 R8 Z2 F1 F; ], v8 m  3) error array must include parameter
  }9 m* |3 z! O) v/ [  4) amethod must be declared with string% u" f- S  @. h2 @
  answer to question 2
. Y* o1 U( ^2 \  --------------------------------------------------------------------------------9 N9 m9 }- h7 l% h3 v6 M! I' n
  question 3)2 D( M, m4 T/ _5 ^9 R
  which of the following will compile without error
6 ~9 n: ?0 ~' N& h  1)4 b) s. x8 \. _$ h; w5 E$ U' M
  import java.awt.*;
  d# ~* h* w1 n1 D9 _  ?  package mypackage;
' k+ E3 w7 |% O' Y1 x  class myclass {}
8 O. K9 z9 z4 M* F5 [* `; e# Q6 z# W  Z2 c1 z8 ?- b: ?9 Y% ^
  2)
# e. ]1 V) q! d0 ?' S9 ^  package mypackage;
1 x  [$ t$ F8 @5 z
( e& w$ E7 {+ N% J. I/ F  import java.awt.*;
回复

使用道具 举报

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

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

</p>  class myclass{}( N" s: z1 n+ H" x3 [! R' p6 q6 E5 G7 H
  3)
# W7 n4 ~: H8 P0 a' b. ?  /*this is a comment */
7 y* V: S! R) z) X( ~5 |  C  package mypackage;$ U8 d9 H: ]: f. V
  import java.awt.*;
1 X: }6 R: c( W; V1 p  class myclass{}
8 V- y8 e2 H; Z  answer to question 35 y! {" g$ {: ~6 q& ^0 ]4 o
  --------------------------------------------------------------------------------
" w. {2 V9 d7 Q, a" R3 I  question 4)
9 G. @! c% X- \, @  a byte can be of what size
* I# S% g1 \+ A( [/ p) {& Y  1) -128 to 127" D( L$ F' O) l$ y5 _+ X
  2) (-2 power 8 )-1 to 2 power 8
8 |. h% R5 G$ n9 q! w6 I3 R  3) -255 to 256
- p) M! i  ]* Y7 f* n  4)depends on the particular implementation of the java virtual machine
* R" C3 s4 Q/ @  r7 k/ [# X  answer to question 46 Q) b5 ~4 O; s+ i
  --------------------------------------------------------------------------------- {5 n  J6 q2 B' n. z8 p
  question 5)( b3 V+ Y2 q3 s4 P
  what will be printed out if this code is run with the following command line?
5 n" B8 Y9 u& |) I$ f  java myprog good morning
4 _- p  e: e" ^4 i. f  public class myprog{3 [7 U4 e3 m; S* A6 E1 P1 ]& j* M
  public static void main(string argv[])' j' s, R1 q0 H+ h+ D
  {8 H1 _) W7 J- V8 b7 P0 b, a
  system.out.println(argv[2])' T& u9 ~: r1 o  f" w& a
  }
. {; @% V7 G) Y4 ?  }
6 G1 r/ k$ t$ s0 O" [  1) myprog
2 x4 E) D; l; V- Q% y+ ]  2) good
3 o) }1 K; v2 r. V  h  3) morning
' b) b" j0 d5 H9 `& p/ \  4) exception raised: 'java.lang.arrayindexoutofboundsexception: 2'
" t1 a6 e% l! x- I* j% l) o  answer to question 5
% q! i; C( J" K$ p3 i  --------------------------------------------------------------------------------
# D" |3 {+ N) d; O* p  question 6)
% V9 \" h5 u8 p1 Y) E  A) F$ ^  which of the following are keywords or reserved words in java?7 O& q/ L: p8 M1 T3 e, \1 a8 P
  1) if
; x) h2 o+ c+ z+ s  2) then
' d8 l& {" [, @* U4 l. u  3) goto1 t4 c1 ]+ `# q; E, _
  4) while
回复 支持 反对

使用道具 举报

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

本版积分规则

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

GMT+8, 2024-5-22 07:11 , Processed in 0.214469 second(s), 23 queries .

Powered by Discuz! X3.4 Licensed

© 2001-2017 Comsenz Inc.

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