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