public class ArrayParse {
public static void main(String[] args) {
double[][] d;
String s = "1,2;3,4,5;6,7,8;";
String[] sFirst = s.split(";");
d = new double[sFirst.length][];
for(int i=0; i<sFirst.length; i++) {
String[] sSecend = sFirst[i].split(",");
d[i] = new double[sSecend.length];
for(int j=0; i<sSecend.length; j++) {
d[i][j] = Double.parseDouble(sSecend[j]);
}
}
for(int i=0; i<d.length; i++) {
for(int j=0; j<d[i].length; j++) {
System.out.print(d[i][j]);
}
System.out.println();
}
}
}
public static void main(String[] args) {
double[][] d;
String s = "1,2;3,4,5;6,7,8;";
String[] sFirst = s.split(";");
d = new double[sFirst.length][];
for(int i=0; i<sFirst.length; i++) {
String[] sSecend = sFirst[i].split(",");
d[i] = new double[sSecend.length];
for(int j=0; i<sSecend.length; j++) {
d[i][j] = Double.parseDouble(sSecend[j]);
}
}
for(int i=0; i<d.length; i++) {
for(int j=0; j<d[i].length; j++) {
System.out.print(d[i][j]);
}
System.out.println();
}
}
}
这句写错,应该改成j<sSecend.length
{
public static void main(String args[])
{
int q=0;
int w;
int a[][]={{2,3},{4,5}};
for( w=0;w<a.length;w++)
System.out.println(a[0][w]+"");
}
}
输出那个数组,哪里出错了,求解