import java.util.*;
public class FinalHashMap {
private static Integer x = new Integer(3);
private static final Map map = new HashMap();
public static void main(String[] args) {
map.put("param1","value1"); // no error
map.put("param2","value2"); // no error
System.out.println(map);
x = 4; //error
System.out.println(x);
}
}
For the above code I get the error for modifying integer but I don't get any error for modifying the HashMap.