偶对转换、对象的基本概念还是不太了解,谢谢指教!Object obj=new Integer(0);
obj=(Object)obj;
if(obj instanceof Integer) System.out.println("Integer");
else System.out.println("Object");
obj=(Object)obj;
if(obj instanceof Integer) System.out.println("Integer");
else System.out.println("Object");
如果你要看到强转,可以这样
Integer i=new Integer(0);
Object obj=(Object)i;
if(obj instanceof Integer) System.out.println("Integer");
else System.out.println("Object");但不管怎样,强转仅仅是引用类型发生变化(你是中国人,现在给你换个称呼地球人。然后判断你这个地球人是不是中国人,其实你还是你啊,不是吗),存储的数据结构并没有变化
特别是hepfei90,谢谢!