What will `map.getOrDefault(“key”, “default”)` return if key is not found?

  1. Exception
  2. null
  3. “default”
  4. 0
Correct answer “default”

Explanation

`getOrDefault()` returns the specified default value if the key is not found.

Update: Admin added a tag on this question

Topics

By Admin · · 29 views