Chapter SIX
Arrays, Generics, and Collections


Exam Objectives

Create Java arrays, List, Set, Map, and Deque collections, and add, remove, update, retrieve and sort their elements.
Use generics, including wildcards.

Answers

1. The correct answer is D.

Explanation:

2. The correct answer is B.

Explanation:

3. The correct answer is D.

Explanation:

A) The code compiles and prints:

1 2 3
1.1 2.2 3.3
one two three

B) The code compiles and prints:

1 2 3
1.1 2.2 3.3

C) The code does not compile due to an error in the printList method.

D) The code does not compile due to an error in the main method.

E) The code compiles but throws a runtime exception when executed.

4. The correct answer is A.

Explanation:

5. The correct answers are C and D..

Explanation:

6. The correct answer is C.

Explanation:

7. The correct answer is D.

Explanation:

8. The correct answer is C.

Explanation:

9 .The correct answer is A.

Explanation:

Do you like what you read? Would you consider?


Do you have a problem or something to say?

Report an issue with the book

Contact me