62,628
社区成员
发帖
与我相关
我的任务
分享
public class Test
{
public static void main(String[] args)
{
Object[] mm = new Object[2];
mm[0] = new String("123");
mm[1] = new String("456");
System.out.println(mm[0]);//ok
String str = (String)mm[0];
System.out.println(str);//ok
String []strs = (String[])mm;//throw ClassCastexpection
System.out.println(strs[0]);
}
}
if(object1 instanceof object2)
{
//进行转换
}