标签:
public interface IObject { } public class Foo implements IObject{ } public class Test extends Foo{ } public class MultiStateTest { public static void main(String args[]){ test(); } public static void test(){ IObject f=new Test(); if(f instanceof java.lang.Object)System.out.println("true"); if(f instanceof Foo)System.out.println("true"); if(f instanceof Test)System.out.println("true"); if(f instanceof IObject)System.out.println("true"); } }
true true true true
标签:
原文地址:http://www.cnblogs.com/Coda/p/4257787.html