FileDocCategorySizeDatePackage
InstanceofNull.javaAPI DocExample379Sun Jan 25 13:48:02 GMT 2004None

InstanceofNull

public class InstanceofNull extends Object
Show that "null instanceof SomeClass" returns false, not a NPE

Fields Summary
Constructors Summary
Methods Summary
public static voidmain(java.lang.String[] args)

		try {
			boolean match = null instanceof Object;
			System.out.println("null instanceof Object == " + match);
		} catch (Throwable t) {
			System.err.println(
			"OK, I admit I was wrong, null instanceof Object throws " + t);
		}