Skip to content
CodeKruPro

Putting the same key twice in a Map

Predict the outputEasyJava only
Main.java
import java.util.*;

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

Graded by exact match. Spaces at the ends of lines and blank lines at the end do not count.

to answer and keep your progress. Reading is free for everyone.