Besides null also gets typecast into any user-defined objects inspite of instanceof returning false.. how is it possible???Thanking in advance
Joined: Dec 13, 2004
null can be cast to any reference type without any side-effects. However, null is never an instance of any class. Therefore, null instanceof Object will return false
Joined: Aug 07, 2003
The "<reference> instanceof <class>" operator works on the actual instance referred to by <reference>. Since a null reference has no class, it cannot be an instace of any class, and it always returns false.
[ Disabled smilies. ] [ February 21, 2005: Message edited by: David Harkness ]