What is the output of the following Java program?
import java.util.HashMap;
import java.util.Map;
public class Main {
public static void main(String[] args) {
Map<String, Integer> m = new HashMap<>();
Integer a = m.put("x", 1);
Integer b = m.put("x", 2);
Integer c = m.put("y", 3);
System.out.println(a + " " + b + " " + c + " " + m.get("x") + " " + m.size());
}
}
put returns the previous value (null if none); the second put replaces 1 with 2.