Problem statement:
what will be the output of the following java code?
what will be the output of the following java code?
- import java.util.ArrayList;
- import java.util.Collections;
- import java.util.HashMap;
- public class Solutions{
- public static void main(String[] args) {
- HashMap<Integer, String> m = new HashMap<>();
- m.put(1001,"A");
- m.put(1002,"B");
- Collections.unmodifiableMap(m);
- m.put(1001,"C");
- System.out.println(m);
- }
- }
Output: {1001=C, 1002=B}
No comments:
Post a Comment