1 / 21
文档名称:

QUESTION NO 51.doc

格式:doc   大小:102KB   页数:21页
下载后只包含 1 个 DOC 格式的文档,没有任何的图纸或源代码,查看文件列表

如果您已付费下载过本站文档,您可以点这里二次下载

QUESTION NO 51.doc

上传人:653072647 2018/11/10 文件大小:102 KB

下载得到文件列表

QUESTION NO 51.doc

相关文档

文档介绍

文档介绍:QUESTION NO: 51
Which two create an instance of an array? (Choose two)
A. int[] ia = new int[15];
B. float fa = new float[20];
C. char[] ca = “Some String”;
D. Object oa = new float[20];
E. int ia[][] = { 4, 5, 6, }, { 1, 2, 3 };
Answer: A, D
Key:考点:关于数组的声明以及实例化。
QUESTION NO: 52
Given:
1. class Super {
2. public int getLenght() { return 4; }
3. }
4.
5. public class Sub extends Super {
6. public long getLenght() { return 5; }
7.
8. public static void main(String[] args) {
9. Super sooper = new Super();
10. Sub sub = new Sub();
11. (
12. () + “,”+ () );
13. }
14. }
What is the output?
A. 4,4
B. 4,5
C. 5,4
D. 5,5
E. Compilation fails.
Answer: E
Key:关于方法的覆盖,返回类型必须一样。
QUESTION NO: 53
Given:
1. public class Test {
2. public static void main(String[] args) {
3. int x = 0;
4. assert (x > 0): “assertion failed”;
5. (“finished”);
6. }
7. }
What is the result?
A. finished
B. Compilation fails.
C. An AssertionError is thrown.
D. An AssertionError is thrown and finished is output.
Answer: A
Key:This question is a bit tricky because it lacks the following information: It should include a
statement that says whether or not assertions are enabled. If they are indeed enabled, the
correction answer is C. but if they are not, the correct answer is A. Assertions are not enabled, by default so if the question is not changed, the most logical answer is A.
断言在默认设置下是不启用的。
QUESTION NO: 54
You want to limit access to a method of a public class to members of the same class.
Which access plishes this objective?
A. public
B. private
C. protected
D. transient
E. default access
Answer: B
Key:考点是四种访问级别,在同一个类的访问是private。
QUESTION NO: 55
Given:
11. switch(x) {
12. default:
13. (“Hello”);
14. }
Which two are acceptable types for x? (Choose two)
A. byte
B. long
C. char
D. float
E. Short
F. Long
Answer: A, C
Key:swtich()里面是基本类型变量,E,F错误。其次要可以自动转