Java Reference
In-Depth Information
3. int x = 7;
4. assert x >= 1 && x <= 6;
5. System.out.println(x);
6. }
7. }
and given the following command line, which of the following statements are true?
(Select two.)
java Question15
A. Line 4 generates a compiler error.
B. Line 4 throws an AssertionError.
C. The output is 7.
D. Line 5 does not execute.
E. The assert statement on line 4 is ignored.
16. Given the following class definition:
1. public class PrintTen {
2. private int x = 10;
3.
4. public void go() {
5. assert x == 10;
6. System.out.println(x);
7. }
8.
9. public static void main(String [] args) {
10. PrintTen pt = new PrintTen();
11. pt.x = 5;
12. pt.go();
13. }
14. }
and given the following command line, which of the following statements are true?
(Select two.)
java -ea PrintTen
A. Line 11 generates a compiler error.
B. The assert statement on line 5 throws an AssertionError.
C. The assert statement on line 5 is ignored.
D. The output is 5.
E. Line 6 does not execute.
Search WWH ::




Custom Search