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


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "instanceof" Watch "instanceof" New topic
Author

instanceof

adam Lui
Ranch Hand

Joined: Sep 03, 2007
Posts: 186



It compiles fine but there is no output. I expected at least "inside int test".
I am passing an int[] array into the method, checking if it is an instance of int[], and was pretty sure it will be true.

what is the problem here?!


boolean b = true;<br />System.out.println ("I believe in Java.<br />Java will make my dream come " + b);
Kelvin Chenhao Lim
Ranch Hand

Joined: Oct 20, 2007
Posts: 513
Although null is a valid value for any reference variable, it is not an instance of any type. In other words, Java defines "null instanceof Type" to always be false, for any class or interface Type.


SCJP 5.0
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: instanceof
 
Similar Threads
Help with Arrays!
int to string conversion using toStirng()
Still unable to call a method
How would i break this down into seperate metods?
array issues