a我考网

 找回密码
 立即注册

QQ登录

只需一步,快速开始

扫一扫,访问微社区

查看: 99|回复: 1

[考试试题] 2011年JAVA认证模拟题第二阶段(12)

[复制链接]
发表于 2012-8-4 12:33:16 | 显示全部楼层 |阅读模式
  Q34.What String instance method would return true when invoked as follows?; p8 v8 [8 G$ D8 `
  1. a.method(b); where a equals “GROUNDhog” and b equals “groundHOG”?
; h) p' y4 b; u4 E+ _. z9 D% u: f4 z  a. equals()
4 C/ ]/ c) u- G4 g7 c  b. toLowerCase()
$ [2 Z4 t. r" b3 |  c. toUpperCase()9 c! f; h4 q5 [
  d. equalsIgnoreCase()
0 h9 q9 @3 V8 R$ B- _1 m0 h$ @. n  Q35.What access control keyword should you use to enable other classes to access a method freely within its package, but to restrict classes outside of the package from accessing that method? Select all valid answers.
. h* I3 i9 n3 g4 x8 l: J  a. private& p) M; N9 {; e* d* O" k0 X
  b. public6 Y8 p7 {  P# [7 L
  c. protected
  J# u, }( q& {. z& }  a$ ^) e  d. Do not supply an access control keyword (friendly).) C8 B, B7 t; _  V& A8 c7 M! P
  Q36.What letters are written to the standard output with the following code?
7 x# t( M& y5 A- J) k% ?7 ?  1. class Unchecked {
5 T2 v% _+ u+ }  2. public static void main(String args[]) {
% T% {( l/ E$ r  3. try {
2 A/ x4 O, T) G9 q( l  4. method();
# H5 @9 A" s5 _' f. |& u9 t) |  5. } catch(Exception e) { }
1 h# W* X! V4 \8 A: \  6. }
2 z& J9 y% i/ d" m  7. static void method() {* g5 E3 q# |, m3 P7 j' X
  8. try {% B( i) k' n' J4 a( f& I

& [! ?6 h7 ]7 m) W: b# b$ {0 q0 w  9. wrench();
回复

使用道具 举报

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

2011年JAVA认证模拟题第二阶段(12)

</p>  10. System.out.println(“a”);
1 N* z. ?; _" e2 w4 C  11. } catch(ArithmeticException e) {
. q* B% v3 y" c, o; o0 G  12. System.out.println(“b”);# |; [: Q6 w% i
  13. } finally {* _5 H" \* A& L
  14. System.out.println(“c”);9 B5 _9 X( N, E, I" L& {6 W
  15. }0 F" x7 X0 z- O% n6 _+ K! u' O
  16. System.out.println(“d”);
8 |$ @1 S1 T$ G$ F7 `: \  17. }
3 H4 n# K4 J% ~. ^4 f6 P  18. static void wrench() {. u* ]- |' l- f
  19. throw new NullPointerException();. o5 g  g! a' N5 L
  20. }
: r8 Z9 s. M9 @0 B# B/ k  21. }2 N/ g% _' l" z5 U
  Select all valid answers.- [$ }9 @/ Q1 O, r9 J
  a. “a”/ G/ G7 M* B7 `& K: A
  b. “b”5 C$ D0 s7 U$ l+ Q; C8 _
  c. “c”! l* s/ i9 ^9 r$ C! J) s
  d. “d”, L$ R/ d% [; T6 K- e( z6 E4 S+ p
  34. d
7 N/ t' k2 c( L; J1 e1 G$ T  35. d) D& B& |5 Q/ p8 F9 X
  36. c
回复 支持 反对

使用道具 举报

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

本版积分规则

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

GMT+8, 2024-5-18 03:27 , Processed in 0.328859 second(s), 23 queries .

Powered by Discuz! X3.4 Licensed

© 2001-2017 Comsenz Inc.

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