java 小问题

public class ArrayParser{
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[] sSecond = sFirst[i].split(",");
d[i] = new double [sSecond.length];
for(int j =0; j<sSecond.length; j++){
d[i][j] =Double.parseDouble(sSecond[j]);

}
}
for( int i =0 ;i<d.length; i ++){
for(int j=0 ;i<d[i].length; j++){
System.out.print(d[i][j] +"");
}
System.out.println();
}
}
}
森栏
浏览 454回答 2
2回答

沧海一幻觉

for(   j.length)

翻阅古今

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();                        }
打开App,查看更多内容
随时随地看视频慕课网APP

相关分类

Java