Why doesn't this Java code generate any compiler error?
Map<String, String> m = new HashMap<String, String>();
m.get(1);
I try to find an Integer in a map which maps Strings to Strings. This is clearly a programming mistake.
Similarly, this code does not generate an error either:
Map<Integer, String> m = new HashMap<Integer, String>();
m.get("dd1");
So Java compiler does not seem to check the type of the argument to Map.get(Object) method. Any ideas?