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