Which statement is true?
哪个语句是正确的?
310 - 035
Leading the way in IT testing and certification tools, www.testking.com
(广告)
-7 -
A. Assertions can be enabled or disabled on a class-by-class basis.
A.在类到类的基础上,声明可以有效或者无效。
B. Conditional compilation is used to allow tested classes to run at full speed.
B.在测试类可以全速运行的情况下,可以使用条件编译。
C. Assertions are appropriate for checking the validity of arguments in a method.
C.使用声明检查方法中参数的正确性是合适的。
D. The programmer can choose to execute a return statement or to throw an exception if
an assertion fails.
D.如果声明失败,程序员可以选择创建一个返回语句或者抛出一个异常。
Answer: A
唉··水平太差了啊··
哪个语句是正确的?
310 - 035
Leading the way in IT testing and certification tools, www.testking.com
(广告)
-7 -
A. Assertions can be enabled or disabled on a class-by-class basis.
A.在类到类的基础上,声明可以有效或者无效。
B. Conditional compilation is used to allow tested classes to run at full speed.
B.在测试类可以全速运行的情况下,可以使用条件编译。
C. Assertions are appropriate for checking the validity of arguments in a method.
C.使用声明检查方法中参数的正确性是合适的。
D. The programmer can choose to execute a return statement or to throw an exception if
an assertion fails.
D.如果声明失败,程序员可以选择创建一个返回语句或者抛出一个异常。
Answer: A
唉··水平太差了啊··
解决方案 »
- 希望哥哥姐姐高手们,帮帮我一个简单问题(Java表格table问题)、在线等-------谢谢
- 火箭赢啦!!放分!!
- ACER待机问题!!!!!!
- 请问有支持VISTA操作系统的ORACLE版本吗?有的话给个链接好吗,谢谢
- java抽奖器(着急)
- 谁可以告诉我封装到底是指的什么啊?没分给了~~SORRY了~
- java中mai函数必须定义在主类或者主类的子类中,才能被执行么?mai函数定义的位置有什么要求?
- 读excel表结构,如何获得所有的sheet名称?
- 当一个引用变量被声明为final时,这意味着不能让这个变量指向某些其他的对象。但是,我们可以通过最终的引用变量访问一个变量,并改变他
- 谁来解忧!!
- 关于文件读写的很简单的问题,虚心的向各位高手学习!
- 过节了,祝大家节日快乐!!! 顺便问一下同步的问题
Given:
给出:
1. package test1;
2. public class Test1 {
3. static int x = 42;
4. }
1. package test2;
2. public class Test2 extends test1.Test1 {
3. public static void main(String[] args) {
4. System.out.println(“x = “ + x);
5. }
6. }
What is the result?
运行结果是?
A. x = 0
B. x = 42
C. Compilation fails because of an error in line 2 of class Test2.
C.编译错误,在类Test2的第2行出错。
D. Compilation fails because of an error in line 3 of class Test1.
D. 编译错误,在类Test1的第3行出错。
E. Compilation fails because of an error in line 4 of class Test2.
E. 编译错误,在类Test2的第4行出错。Answer: C
//////////////////////////////////////////
QUESTION NO: 23
Which statement is true about assertion in the Java programming language?
在Java中,下面的关于声明的说法哪个是正确的?
A. Assertion expressions should not contain side effects.
A.声明语句不能包含歧义(?)。
B. Assertion expression values can be any primitive type.
B.声明语句的值可以是任何简单类型。
C. Assertion should be used for enforcing preconditions on public methods.
C.声明只能用于公用方法的强制预处理中。
D. An Assertion Error thrown as a result of a failed assertion should always be handled by
the enclosing method.
D.错误的声明总是在封装起来的方法里面处理。
Answer: A
////////////////////////////////////
QUESTION NO: 43
Given:
给出:
1. class TestA {
2. TestB b;
3. TestA() {
4. b = new TestB(this);
5. }
6. }
7. class TestB {
8. TestA a;
9. TestB(TestA a) {
10. this.a = a;
11. }
12. }
13. class TestAll {
14. public static void main (String args[]) {
15. new TestAll().makeThings();
16. // ...code continues on
17. }
18. void makeThings() {
19. TestA test = new TestA();
20. }
21. }
Which two statements are true after line 15, before main completes? (Choose two)
对于15行以后和main函数结束之间的部分,哪两句话是正确的。
A. Line 15 causes a stack overflow.
A.15行产生一个堆栈溢出。
B. An exception is thrown at runtime.
B.将会抛出运行时错误。
C. The object referenced by a is eligible for garbage collection.
C.a引用的对象符合垃圾收集的条件。
D. The object referenced by b is eligible for garbage collection.
D. b引用的对象符合垃圾收集的条件。
E. The object referenced by a is not eligible for garbage collection.
E. a引用的对象不符合垃圾收集的条件。
F. The object referenced by b is not eligible for garbage collection.
F. b引用的对象不符合垃圾收集的条件。
Answer: C, F
2. public class Test1 {
3. static int x = 42;
4. }
1. package test2;
2. public class Test2 extends test1.Test1 {
3. public static void main(String[] args) {
4. System.out.println(“x = “ + x);
5. }
6. }
What is the result?
运行结果是?
A. x = 0
B. x = 42
C. Compilation fails because of an error in line 2 of class Test2.
C.编译错误,在类Test2的第2行出错。
D. Compilation fails because of an error in line 3 of class Test1.
D. 编译错误,在类Test1的第3行出错。
E. Compilation fails because of an error in line 4 of class Test2.
E. 编译错误,在类Test2的第4行出错。
Answer: C