(1)在java中所有类都是object的子类,数组也不例外
(2)测试程序:
Object[] oObjArray = {"a","b"};
Object oObj = oObjArray; //这句执行没有问题
String[] oStrArray = (String[] )oObj; //不行
(3)测试程序:
Object o = new String[]{"a","b","c"};
String[] oStrArray = (String[])o; ///Ok
posted on 2005-10-27 19:17 一直在努力 ! 阅读(182) 评论(0) 编辑 收藏 所属分类: Java
Powered by: BlogJava Copyright © 一直在努力 !