A

Admin • 832.27K Points
Coach

Q. How can you create an immutable Map in Java 9?

  • (A) new HashMap<>()
  • (B) Map.of()
  • (C) Collections.unmodifiableMap()
  • (D) Map.emptyMap()
  • Correct Answer - Option(B)
  • Views: 32
  • Filed under category Java
  • Hashtags: Java Map

Explanation by: Admin

`Map.of()` creates an immutable Map introduced in Java 9.

You must be Logged in to update hint/solution

Discusssion

Login to discuss.

Be the first to start discuss.