File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes null instanceof aclass Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "null instanceof aclass" Watch "null instanceof aclass" New topic

null instanceof aclass

Giselle Dazzi
Ranch Hand

Joined: Apr 20, 2003
Posts: 168
I know I should remember this but I need to use it now and can you guys confirm to me if
null always evaluate true if we do an
null instanceof ClassWhatever ?

Giselle Dazzi<br />SCJP 1.4
Ernest Friedman-Hill
author and iconoclast

Joined: Jul 08, 2003
Posts: 24183

It always evaluates to false, not to true.

[Jess in Action][AskingGoodQuestions]
Don't get me started about those stupid light bulbs.
subject: null instanceof aclass
Similar Threads
Casting a null object...
cast & instanceof
instanceof problem...scjp book page no.285
Clean way of checking if object type is primitive or String
null instanceof an Object ?