a simple java project for testing some assumptions about the language.
[feisty_meow.git] / kona / z-testing / src / test / java / semantics / instance_of.java
diff --git a/kona/z-testing/src/test/java/semantics/instance_of.java b/kona/z-testing/src/test/java/semantics/instance_of.java
new file mode 100644 (file)
index 0000000..3900856
--- /dev/null
@@ -0,0 +1,29 @@
+
+
+package test.java.semantics;
+
+import java.util.List;
+
+class instance_of
+{
+    public instance_of() {}
+    
+    public Object cogitate() {
+        return null;
+    }
+
+    public static void main(String s[]) throws Exception
+    {
+        // we are just asserting that it is safe to do instanceof on an object that is null.
+        // let's test that theory.
+        instance_of tony = new instance_of();
+        Object fred = tony.cogitate();  // will produce null.
+        if (fred instanceof List<?>) {
+            throw new Exception("that should not have happened!");
+        } else {
+            System.out.println("told us null is not an instance of List, which is correct.");
+        }
+        
+    }
+
+}
\ No newline at end of file