Which keyword creates an immutable list in Java 9+?
-
A
Arrays.asList()
-
B
Collections.unmodifiableList()
-
C
List.of()
Correct answer
-
D
new ImmutableList<>()
Correct answer
C. List.of()
13 views
Explanation
List.of() returns unmodifiable list.
Doubts & discussion
Not sure why the answer is C? Ask here and get an explanation.
Ask a doubt about this MCQ