这可能是一个荒谬的问题,但我没有做到。我有两个这种类型的数组:
String[] string{"A", "B", "C"}
和
int[][]数组 {{1, 2, 3},{1, 2, 3}}
并希望获得此输出:
A 1 1
B 2 2
C 3 3
我几乎尝试了所有可能的 for 循环,但它没有按这个顺序。 非常感谢您对我的帮助!
最佳答案
试试这个:
// INIT ARRAYS
String[] abcArray = {"A", "B", "C"};
int[][] otherArray = {{1, 2, 3},{1, 2, 3}};
// LOOP ABC ARRAY
for(int x = 0; x < abcArray.length; x++){
// PRINT
system.out.println(abcArray[x]+otherArray[0][x]+otherArray[1][x]);
}
关于java - 返回 int[][] 数组,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/44398878/