Originally posted by Ram Manoj:
... But I need what actually happens if I call test1.testMe(null)
The
null literal represents the "null type." So when you use a null literal with callMe, it fails because the argument type is ambiguous. But assigning a null literal to a variable...
Object obj = null;
test1.callMe(obj);
...will work, because the
reference type of "obj" is Object, even though it doesn't point to an actual object.
This is essentially what's happening when you call testMe with a null literal. The null literal is assigned to the local variable 'o', and the type of 'o' is Object, so calling callMe(o) works.
[ March 09, 2008: Message edited by: marc weber ]