1 package test.java.semantics;
7 public instance_of() {}
9 public Object cogitate() {
13 public static void main(String s[]) throws Exception
15 // we are just asserting that it is safe to do instanceof on an object that is null.
16 // let's test that theory.
17 instance_of tony = new instance_of();
18 Object fred = tony.cogitate(); // will produce null.
19 if (fred instanceof List<?>) {
20 throw new Exception("that should not have happened!");
22 System.out.println("told us null is not an instance of List, which is correct.");