According to Kathy Sierra SCJP 6, when a class has overloaded methods, during method matching, the JVM will select the method with the smallest argument that is wider than the parameter.
In SCENARIO A, Integer and Double both qualify because none of them is wider than the other and they are both wider than the parameter i.e. null, so the compiler complains The constructor TestClass(Integer) is ambiguous.
In SCENARIO B, the compiler is happy because Object is wider than Double. The second constructor runs because the JVM will select the method with the smallest argument that is wider than the parameter.
Thanks for the reply. But just out of curiosity in the first scenario I changed the Double to Long, Float and even Hash Map or some other object. Still I get the compilation error. Only if I give Object, it gets resolved.