Loading…
december code / try / java
No account needed. Answer, see why, move on.
Problem
Run this Java 17 snippet inside main(String[] args) throws Exception, with java.util.*, java.util.stream.*, java.util.function.*, java.math.* and java.time.* imported.
main(String[] args)
try { Map.of("x", 1, "x", 2); } catch (IllegalArgumentException e) { System.out.println("duplicate"); }
Which option matches the result?
duplicate
1
2
null
Nothing here is saved. Create a free account to keep your progress, take an assessment and get your readiness score.