package com.itheima.test02;
public class Test01 {
public static void main(String[] args) {
/*
* 外层循环控制 行, 内层循环控制列
*
* 嵌套循环
*
* **/
for(int i =0 ;i<3;i++ ){
for(int a = 0 ;a < 5 ;a++){
System.out.print("* ");
}
System.out.println();
}
System.out.println("=========================");
int[][] arr= {{1,2,3},{4,5,6},{7,8,}};
for(int i = 0;i < arr.length;i++){
for(int j = 0;j <arr[i].length;j++){
System.out.println("arr[i] [j] "+ arr[i][j]);
}
}
}
}
|
|