Exam 1z0-819 All QuestionsBrowse all questions from this exam
Question 10

Given:

What is the result?

    Correct Answer: C

    The `Collections.unmodifiableList(list1)` method creates a read-only view of `list1`, meaning that any attempt to modify `list2` directly would result in an exception. However, modifications to `list1` are still reflected in the unmodifiable view `list2` because both lists point to the same underlying collection. Therefore, printing `list1` and `list2` will both output `[A, B, C]` since `list1` was modified by adding the element "C".

Discussion
pikosssOption: C

C -> the list2 is executed before the runtime

Ankit1010Option: C

C is the right answer

APJ1Option: C

C is correct answer because list2 is Unmodified & is never modified. So, no exeception !

d7bb0b2Option: C

C, because unmodifiableList generate a copy of view for the first list, if the list1 add more element then list2 point to the same list.

StavokOption: C

C is the correct answer