a我考网

 找回密码
 立即注册

QQ登录

只需一步,快速开始

扫一扫,访问微社区

查看: 121|回复: 1

[考试试题] JAVA认证历年真题:310-025精选题(33)

[复制链接]
发表于 2012-8-4 12:33:16 | 显示全部楼层 |阅读模式
310-025精选题(33)的具体内容如下:* U- Q  t" }  j9 c/ n; \$ X- c
121b. Consider the following code. What will be on the output.6 W8 P. M; @/ S
public class Mock3ExceptionTest{& ~; D( ^/ @- l4 `( C
public static void main(String [] args){7 a6 K2 \$ r' B
Mock3ExceptionTest e = new Mock3ExceptionTest();
4 |7 r  F- d% D$ z. ?e.trythis();4 r& |! U, z0 x' p6 h, N7 T" p
}& \, @/ ^% Q0 U* v: e
public void trythis(){  |" Q* z# V0 F
try{9 E/ R+ ^, t" m# N
System.out.println("1");
4 Z* k0 _" G! Z- aproblem();1 i7 R# H. C, E  r9 e. V5 E
System.out.println("1b");, F6 p0 s" X3 @5 [9 v; p
}
* y1 x7 U; `! x" T1 Z2 X: X# dcatch(Exception x){
! F* ^& T1 f4 p7 FSystem.out.println("3");1 ?! f% \# U, E% K
}
+ u  m; p* U+ q% kfinally{2 V) p3 Q$ R3 Z' W  `
System.out.println("4");
$ M8 ?4 [4 B' J) l# W: B6 d}
% b! g! h9 w2 w3 }7 c5 B/ jSystem.out.println("5");* R" D$ ]7 }& {1 o
}7 A- F) S# B9 E0 S' D7 [% s
public void problem()throws Exception{
0 Z. X, B; @0 E- B& x* L1 A+ Q' M$ W8 X7 cthrow new Exception();
( _0 K+ W+ ]. E3 v; b! W+ ?" R}" \) P4 R; d+ R
} A. 1
0 c, k' u# J1 J1 DB 1b, v. s" m. c% C+ j! X" U
C. 3
: r; Q+ o1 s" g+ y) {D. 40 `( ?/ d' p2 K- i1 ^
E. 5
# E4 Q3 }9 J3 c8 \$ }ACDE.
回复

使用道具 举报

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

JAVA认证历年真题:310-025精选题(33)

122. What can you put where the X is?0 o. ^% J) w% o, s: m1 A
X& ?2 M/ V( l) f- a. Q
Public class A{}
( k2 t5 U' K: S- Y8 T* S; [9 C; pA. import java.awt.*;8 g- T' B' `, V1 v! E
B. package bla.bla;" f% N, _2 e9 Q' d
C. class bla{}3 _! r/ p+ `, O+ n2 B$ r
D. public abstract final method();1 d8 H  x! q% J4 t
E. public final int x = 1000;# w! I2 p  U" t, g! |
ABC.
6 S9 E5 T* a' ~# w3 T) w* S123. What are the characteristics of a totally encapsulated class? One answer.9 G, N0 s# U' M
A. methods not private! e) P- j* r. E4 N! F" }
B. variables not public+ }. [0 ?( S5 [# w* V
C. ......) Y8 S2 D+ ?: D
D. all modifying of the object should be made through methods. H& b8 X, X, [/ T
D.' H" I: |  {% m3 C7 ?, E
124. Consider the following code:
+ Q" V  A: S8 J+ O/ k& x# Npublic class TBMock1{
5 F) U+ O" S) r* k& H/ wpublic static void main(String[]args){
  L( k* C2 z: wInteger n = new Integer(7);
- ?) G" B7 B5 \, ^  h% n5 n3 sInteger k = new Integer(7);
: g/ d5 z1 g' y9 _# a8 R' j" N8 RLong i = new Long(7);+ g# [7 N! _5 l! s
}
3 ?- P) A* c$ [" T- e* i}
% A6 N6 m* A. ]3 q+ L2 }Which return true?' h: o) Q: X% ?( \9 |  y
A. n==i8 `. p* @) B3 R  n! i
B. n==k
9 U  B1 w; q  I& mC. n.equals(k)
5 I* L0 ^" o  R  p7 h: JD. n.equals(7)# `# \2 }2 M1 @2 [1 V1 D
E. n.equals(new Integer(7))6 w! Y( {( T: H) o4 X7 b' t$ x& i2 Q
CE.# e- {$ f$ y: v$ j; V
125. Write 7 in hexadecimal. Do not use more than four characters and do no assignment./ h% z: Z  ]0 u; m0 N2 }
Answer:3 Q9 y: d1 @5 r8 ?  @7 B
0x7, 0x07
5 V% c' Z4 d8 o$ H126. Consider the classes defined below:
% o: C1 O8 ~$ [% f% Cimport java.io.*;
8 D! Z# k  d" b- d/ cclass Super{, b; D' S9 D( [2 J
void method (int x, int b)8 L+ Q, z7 H7 z
}8 O( n$ H& ~) Q* }- N: ]+ D
class Sub extends Super{}
+ y: M7 m1 H9 A8 LHow will a correct method in Sub look like?! w- u0 S' k& `4 B/ W
A. int method(int x, int b)
4 e/ u4 T# ^) g) C9 ^, \8 sB. void method (int x) throws Exception$ R# ?4 t+ g) p5 ]; f
C. void anotherMethod(int x)7 _( t) r8 `; |4 Z' V/ m
D. ........, Q* ?7 P; w/ @, W) h" |+ [
BC.
回复 支持 反对

使用道具 举报

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

本版积分规则

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

GMT+8, 2024-5-19 03:35 , Processed in 0.192874 second(s), 23 queries .

Powered by Discuz! X3.4 Licensed

© 2001-2017 Comsenz Inc.

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