public static void main(String[] args) {
int[][] a = new int[2][3];
int[][] b = new int[3][2];
int k = 1;
System.out.println("转置前数组:");
for(int i = 0 ; i < 2 ; i++){
for(int j = 0 ; j <3 ;j ++){
a[i][j] = k;
k++;
System.out.print(a[i][j]+" ");
}
System.out.print("
");
}
System.out.println("转置后数组:");
for(int i = 0 ; i < 3 ; i++){
for(int j = 0 ; j < 2 ;j ++){
b[i][j] = a[j][i];
System.out.print(b[i][j]+" ");
}
System.out.print("
");
}
}
}