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? 

10: var m = new TreeMap (); 11 m.put(1, 4); 12: m.put

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

1 Expert Approved Answer
Step: 1 Unlock

Answer The correct answer is B 2 Heres the breakdown of t... View full answer

blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Oracle Questions!