It is not System.Object or System.sObject, because we can pass null to methods which require System.String as a parameter, and cannot pass System.Object there.
Following code demonstrated difference between System.Object and th type of the null literal:
'abc'.contains(null); // compiler does not complain
boolean b;
'abc'.contains(b?null:null); // compiler does not complain
Object o = b?null:null;
'abc'.contains(o); // compiler error
So the question is, what type null literal and expression b?null:null
have?
Is there a standard library function like typOf, so that I could call typOf(null)
?
null
is just a blank reference i guess which does not have memory allocated.The type we say is of reference and not of thenull
value. – Mr.Frodo 2 days ago