RTTI-Runtime type identification


public class Test {
 public static class A{
 }
 
 public static class B extends A{
 }
 
 public final static void main(String[] args){
  A a = new A();
  A a1 = null;
  B b = new B();
  B b1 = null;
  //b1 = (B)a; //Test$A cannot be cast to Test$B
  b1 = (B)a1;
 }
}
posted @ 2011-02-22 17:31  kelin1314  阅读(189)  评论(0编辑  收藏  举报