Vector问题 String buf[][];buf=new String[2][];for(int i=0;i<2;i++) { buf[i]=new String[5]; Vector two=one.elementAt(i);} 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 String buf[][];buf=new String[2][];for(int i=0;i<2;i++) { buf[i]=new String[5]; Vector two=one.elementAt(i); for(int j=0;j<5;j++) { buf[i][j]=(String)two.elementAt(j); }} Vector one=new Vector();Vector two=new Vector();for(int i =0;i<2;i++){ for(int j=0;j<5;j++){ two=new Vector(); Integer IntTemp=new Integer(j); String strResult=IntTemp.toString(); two.addElement(strResult); }one.addElement(two);}Object s[]=one.toArray();Object s1[]=two.toArray(s); 楼主程序有问题。Vector one=new Vector();Vector two;for(int i =0;i<2;i++){ for(int j=0;j<5;j++){ two=new Vector(); <================这个要放在第二循环的外面。 Integer IntTemp=new Integer(j); String strResult=IntTemp.toString(); two.addElement(strResult); }one.addElement(two);}如下 java.util.Vector one = new Vector(); java.util.Vector two = null; for (int i = 0; i < 2; i++) { two = new Vector(); for (int j = 0; j < 5; j++) { Integer IntTemp = new Integer(j); String strResult = IntTemp.toString(); two.addElement(strResult); } one.addElement(two); } String[][] rs = new String[one.size()][]; for (int i = 0; i < one.size(); i++) { java.util.Vector vect = (java.util.Vector) one.elementAt(i); rs[i] = new String[vect.size()]; vect.copyInto(rs[i]); } bluesmile979(笑着)那是想象的结果,是他要的效果 如何理解对象中存放着引用? 用dom4j修改xml的时候报的错,在线等。 问题 请教一下Hashmap类 弹出 提示对话框 提示密码输入错误,是用那个组件? 在线等 怎么在Socket Server中实现socket转发 "Frame1.java": Fatal Error: Unable to locate package java.lang in classpath or bootclasspath是怎么回事啊?? 高手请指教,这个语句的参数是什么意思? 有关软件本地化的问题 一道SCJP题目 struts问题请教? Thread-safe and Fail-fast
buf=new String[2][];
for(int i=0;i<2;i++) {
buf[i]=new String[5];
Vector two=one.elementAt(i);
for(int j=0;j<5;j++) {
buf[i][j]=(String)two.elementAt(j);
}
}
Vector two=new Vector();
for(int i =0;i<2;i++){
for(int j=0;j<5;j++){
two=new Vector();
Integer IntTemp=new Integer(j);
String strResult=IntTemp.toString();
two.addElement(strResult);
}
one.addElement(two);
}
Object s[]=one.toArray();
Object s1[]=two.toArray(s);
Vector one=new Vector();
Vector two;
for(int i =0;i<2;i++){
for(int j=0;j<5;j++){
two=new Vector(); <================这个要放在第二循环的外面。
Integer IntTemp=new Integer(j);
String strResult=IntTemp.toString();
two.addElement(strResult);
}
one.addElement(two);
}如下
java.util.Vector one = new Vector();
java.util.Vector two = null;
for (int i = 0; i < 2; i++)
{
two = new Vector();
for (int j = 0; j < 5; j++)
{
Integer IntTemp = new Integer(j);
String strResult = IntTemp.toString();
two.addElement(strResult);
}
one.addElement(two);
}
String[][] rs = new String[one.size()][];
for (int i = 0; i < one.size(); i++)
{
java.util.Vector vect = (java.util.Vector) one.elementAt(i);
rs[i] = new String[vect.size()];
vect.copyInto(rs[i]);
}
那是想象的结果,是他要的效果