Question: What is the output of this code? A. 1 B. 2 C. 3 D. 4 E. The code does not compile. F. The code compiles
What is the output of this code?

A. 1
B. 2
C. 3
D. 4
E. The code does not compile.
F. The code compiles but prints something else.
10: var m = new TreeMap (); 11 m.put(1, 4); 12: m.put (2, 8); 13: 14: m.putIfAbsent (2, 10); 15: m.putIfAbsent (3, 9); 16: 17: m.replaceAll((k, v) -> k + 1); 18: 19: 20: 21: 22: 23: m.entrySet().stream() .sorted (Comparator.comparing (Entry::getKey)) .limit (1) .map (Entry::getValue) .forEach (System.out::println);
Step by Step Solution
3.39 Rating (149 Votes )
There are 3 Steps involved in it
Answer The correct answer is B 2 Heres the breakdown of t... View full answer
Get step-by-step solutions from verified subject matter experts
