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