第1个回答 推荐于2019-09-13
public class xiti5_5 {
public static void Printf(int a[][]) {
for (int i = 0; i < a.length; i++) {
for (int j = 0; j < a[i].length; j++) {
System.out.print(a[i][j] + " ");
}
System.out.println();
}
}
public static int[][] FangFa(int a[][]) {
int b[][] = new int[a[0].length][a.length];
for (int i = 0; i < a[0].length; i++) {
for (int j = 0; j < a.length; j++)
b[i][j] = a[j][i];
}
return b;
}
public static void main(String args[]) {
int a[][] = { { 1, 2, 3 }, { 4, 5, 6 } };
Printf(a);
Printf(FangFa(a));
}
}
-----------------
1 2 3
4 5 6
1 4
2 5
3 6本回答被网友采纳