Студопедия

КАТЕГОРИИ:

АвтомобилиАстрономияБиологияГеографияДом и садДругие языкиДругоеИнформатикаИсторияКультураЛитератураЛогикаМатематикаМедицинаМеталлургияМеханикаОбразованиеОхрана трудаПедагогикаПолитикаПравоПсихологияРелигияРиторикаСоциологияСпортСтроительствоТехнологияТуризмФизикаФилософияФинансыХимияЧерчениеЭкологияЭкономикаЭлектроника



Java AssertStuff

Java -ea AssertStuff

What is the result?

A. passed stuff

B. stuff passed

C. passed An AssertionError is thrown with the word "stuff" added to the stack trace.

D. passed An AssertionError is thrown without the word "stuff" added to the stack trace.

E. passed An AssertionException is thrown with the word "stuff" added to the stack trace.

F. passed An AssertionException is thrown without the word "stuff" added to the stack trace.

 

Click the Exhibit button.

1. public class Test {

2.

3. public static void main(String [] args) {

4. boolean assert = true;

5. if(assert) {

6. System.out.println("assert is true");

7. }

8. }

9.

10. }

Given:

javac -source 1.3 Test.java

What is the result?

A. Compilation fails.

B. Compilation succeeds with errors.

C. Compilation succeeds with warnings.

D. Compilation succeeds without warnings or errors.

 

Click the Exhibit button.

1. public class Test {

2.

3. public static void main(String [] args) {

4. boolean assert = true;

5. if(assert) {

6. System.out.println("assert is true");

7. }

8. }

9.

10. }

Given:

javac -source 1.3 Test.java

What is the result?

A. Compilation fails.

B. Compilation succeeds with errors.

C. Compilation succeeds with warnings.

D. Compilation succeeds without warnings or errors.

 

74. Given:

23.int z=5;

24.

25. public void stuff1(int x) {

26. assert (x> 0);

27. switch(x) {

28. case 2: x= 3;

29. default: assert false; } }

30.

31. private void stuff2(int y) { assert (y < 0); }

32.

33. private void stuff3() { assert (stuff4O); }

34.

35. private boolean stuff4() { z = 6; return false; }

Which is true?

A. All of the assert statements are used appropriately.

B. Only the assert statement on line 31 is used appropriately.

C. The assert statements on lines 29 and 31 are used appropriately.

D. The assert statements on lines 26 and 29 are used appropriately.

E. The assert statements on lines 29 and 33 are used appropriately.

F. The assert statements on lines 29, 31, and 33 are used appropriately.



G. The assert statements on lines 26, 29, and 31 are used appropriately.

 

Click the Exhibit button.

SomeException:

1. public class SomeException {

2. }

Class A:

1. public class A {

2. public void doSomething() { }

3. }

Class B:

1. public class B extends A {

2. public void doSomething() throws SomeException { }

3. }

Which is true about the two classes?

A. Compilation of both classes will fail.

B. Compilation of both classes will succeed.

C. Compilation of class A will fail. Compilation of class B will succeed.

D. Compilation of class B will fail. Compilation of class A will succeed.

Click the Exhibit button.


Дата добавления: 2015-09-13; просмотров: 6; Нарушение авторских прав


<== предыдущая лекция | следующая лекция ==>
Click the Exhibit button. | Class TestException
lektsii.com - Лекции.Ком - 2014-2019 год. (0.011 сек.) Все материалы представленные на сайте исключительно с целью ознакомления читателями и не преследуют коммерческих целей или нарушение авторских прав
Главная страница Случайная страница Контакты