A

Admin • 833.24K Points
Coach

Q. What will happen if you try to modify a map created with `Map.of()`?

  • (A) Modifications are allowed
  • (B) It throws `UnsupportedOperationException`
  • (C) It silently ignores changes
  • (D) It updates only values
  • Correct Answer - Option(B)
  • Views: 28
  • Filed under category Java
  • Hashtags: Java Map

Explanation by: Admin

Maps created using `Map.of()` are immutable, and modifications throw an exception.

You must be Logged in to update hint/solution

Discusssion

Login to discuss.

Be the first to start discuss.