Skip to content
Quiz · Collections and generics · lesson 10 of 13

Quiz — put with the same key

Question 1 of 2

What does the program print?

JAVA
import java.util.HashMap;
import java.util.Map;

public class Main {
    public static void main(String[] args) {
        Map<String, Integer> m = new HashMap<>();
        m.put("a", 1);
        m.put("a", 2);
        System.out.println(m.get("a") + " " + m.size());
    }
}