1. Home
  2. Computer Science MCQs
  3. JAVA
  4. Which keyword creates an immutable list in Java 9+?

Added 14 Sep 2025

Which keyword creates an immutable list in Java 9+?

  1. Arrays.asList()
  2. Collections.unmodifiableList()
  3. List.of() Correct answer
  4. new ImmutableList<>()

Correct answer

C. List.of()

14 views

MCQSEXAM

Explanation

List.of() returns unmodifiable list.

Reference

https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/util/List.html#of(E...)

Doubts & discussion

Not sure why the answer is C? Ask here and get an explanation.

Ask a doubt about this MCQ

Shown after review. No links please.

More JAVA MCQs

Practise all JAVA MCQs

Similar MCQs