2011年JAVA认证模拟题第二阶段(12)
Q34.What String instance method would return true when invoked as follows?1. a.method(b); where a equals “GROUNDhog” and b equals “groundHOG”?
a. equals()
b. toLowerCase()
c. toUpperCase()
d. equalsIgnoreCase()
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.
a. private
b. public
c. protected
d. Do not supply an access control keyword (friendly).
Q36.What letters are written to the standard output with the following code?
1. class Unchecked {
2. public static void main(String args[]) {
3. try {
4. method();
5. } catch(Exception e) { }
6. }
7. static void method() {
8. try {
9. wrench();
2011年JAVA认证模拟题第二阶段(12)
</p> 10. System.out.println(“a”);11. } catch(ArithmeticException e) {
12. System.out.println(“b”);
13. } finally {
14. System.out.println(“c”);
15. }
16. System.out.println(“d”);
17. }
18. static void wrench() {
19. throw new NullPointerException();
20. }
21. }
Select all valid answers.
a. “a”
b. “b”
c. “c”
d. “d”
34. d
35. d
36. c
页:
[1]