遍历二维数组

/**
 * Created by Administrator on 2018/10/28.
 */
public class shuzu2 {
    public  static void main(String [] args){
        int a[][]=new int[][]{{1},{2,3},{3,4,5}};
//        for (int k=0;k<a.length;k++){
//            for (int c=0;c<a[k].length;c++){
//                System.out.print(a[k][c]);
//            }
//            System.out.println ( );
//        }
        for (int i[]:a){//将所有行元素提取出来
            for (int j:i){//将所有列元素提取出来
                System.out.print (j);
            }
            System.out.println ( );
        }
    }
}
原文地址:https://www.cnblogs.com/llhhcc/p/9867331.html