LinkedList=newLinkedList()添加(“.”)…字符串[]str=新字符串[最小尺寸]利斯特.托雷(STR)这样,object[]数组就变成了string[]数组。您可以参考toarray()方法的原型:publicsynchronized<T>t[]toarray(t[]a){if(a.length<elementcount)a=(t[])java.lang.reflect文件.Array.newInstance新实例(a.getClass().getComponentType(),元素计数)系统.arraycopy(elementData,0,a,0,elementCount)if(a.length>elementCount)a[elementCount]=null返回a}
object[]objs=newobject[]{“1”,“2”,“3”}string[]strs=新字符串[对象长度]对象副本(STRs,0)当然,您必须确保对象中的每个对象都是字符串。如果对象数组中有以下多种对象类型:object[]objects=newobject[]1,1,2.3}。对于(inti=0i<objs.Lengthi公司){STRs[i]=objs[i]。Tostring()}
Object类型转String数组?object可以直接转换成String数组吗?在线等?怎么将string转化成object数组?在Java中,可以使用for循环或while循环逐个取出对象的数据,并分别为字符串数组赋值。但这也要求对象是实体类或具有属性。闪回和上面一样。