2a5f2b0fb0532d20468e94d6eb83ec3ec4b9822c
[feisty_meow.git] / kona / src / test / java / semantics / instance_of.java
1 package test.java.semantics;
2
3 import java.util.List;
4
5 class instance_of
6 {
7     public instance_of() {}
8     
9     public Object cogitate() {
10         return null;
11     }
12
13     public static void main(String s[]) throws Exception
14     {
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!");
21         } else {
22             System.out.println("told us null is not an instance of List, which is correct.");
23         }
24         
25     }
26 }