MarcusV(南墙大佬的搬运工)

南墙大佬的CSDN博客地址

导航

java实现数组转置

** 数组转置**

编写程序将2行3列的数组行列置换复制给3行2列的数组(即数组的转置)。已经写了如下代码,请完善之:

class  y{
    public static void main(String[] args) throws Exception {
        int a[][]={{1,2,3},{4,5,6}};
        int b[][]=new int[3][2];
        for(int i=0;i<2;i++){
            for(int j=0;j<3;j++){
                _____________________;
            }    
        }            
    }
}


b[j][i] = a[i][j]

posted on 2019-07-30 09:35  MarcusV  阅读(29)  评论(0)    收藏  举报