2014年2月27日

java中instanceof和getClass()的区别分析

摘要: 本篇文章介绍了,在java中instanceof和getClass()的区别分析。需要的朋友参考下 class A { }class B extends A { }Object o1 = new A();Object o2 = new B();o1 instanceof A => trueo1 instanceof B => falseo2 instanceof A => true // trueo1.getClass().equals(A.class) => trueo1.getClass().equals(B.class) => falseo2.getClas 阅读全文

posted @ 2014-02-27 17:32 leihupqrst 阅读(329) 评论(0) 推荐(0)

导航