Re: [问题] 请问JAVA有二维字串这种东西吗?

楼主: qrtt1 (有些事,有时候。。。)   2020-02-04 21:55:19
※ 引述《SST2000 (BMW 428i)》之铭言:
: String []str = {"abc","bca","cab","cba","aaa","111","232","112","ABC"}; 字串阵
: 列宣告方式
: 请问有二维自串这种东西吗??
比 1 维再多 1 个维度,不就是 2 维了吗?
public class Foo {
public static void main(String[] args) {
String[][] strings = {{"A", "B", "C"}, {"D", "E", "F"}};
for (int i = 0; i < strings.length; i++) {
for (int j = 0; j < strings[i].length; j++) {
System.out.printf("%s ", strings[i][j]);
}
System.out.println();
}
}
}

Links booklink

Contact Us: admin [ a t ] ucptt.com