20220207 º¹½À
     
2Â÷¿ø ¹è¿­ ÃʱâÈ­
int[ ][ ] arr = new int[ 2 ][ 2 ]; =>Çà¿­ ±æÀÌ Á¤ÇÑ ÈÄ, ¹Ø¿¡ Çϳª¾¿ °ª ÃʱâÈ­ ÇؾߵÊ
int[ ][ ] arr = new int[ ]{ {1,2} , {3,4} }; => Çà¿­ ±æÀÌ ºñ¿î ÈÄ, ¹Ù·Î °ª ÃʱâÈ­

¹è¿­¸í.length => ¹è¿­ÀÇ ±æÀÌ
¹è¿­¸í[ i ].length => iÇàÀÇ ±æÀÌ

printf ·Î Çü½ÄÈ­µÈ Ãâ·Â »ç¿ëÇϱâ (p.36~39)

2Â÷¿ø ¹è¿­°ú »ç¿ëÀÚ Á¤ÀÇ ÇÔ¼ö

class T0207_26//2Â÷¿ø ¹è¿­
{
     static void f1(int arr[][]){
          for(int i=0;i<arr.length;i++){
               for(int j=0;j<arr[i].length;j++){
                    
                    System.out.print("["+arr[i][j]+"]");//print´Â °¡·Î·Î Ãâ·Â, printlnÀº ¼¼·Î·Î Ãâ·Â
               }
                     System.out.println();//¼¼·Î·Î ÇÑÄ­ ÁÙ ³»·Á¿È
          }

     }

     public static void main(String[] args)
     {
          int[][] arr = new int[3][3];//¹è¿­ ±æÀ̸¸ ¼³Á¤ ÈÄ, ¹Ø¿¡¼­ °ª ÃʱâÈ­ ½ÃÅ°±â
          arr[0][0]=1;
          arr[0][1]=2;
          arr[0][2]=3;
          arr[1][0]=4;
          arr[1][1]=5;
          arr[1][2]=6;
          arr[2][0]=7;
          arr[2][1]=8;
          arr[2][2]=9;

          int[][] arr2 = new int[][]{{11,12,13},{14,15,16},{17,18,19}};
          //¹è¿­ ±æÀÌ ¼³Á¤X Áß°ýÈ£·Î ¹­¾î¼­ ¹Ù·Î °ª ÃʱâÈ­
          f1(arr);
          f1(arr2);
          System.out.println();
     }
}

2Â÷¿ø ¹è¿­À» ÀÌ¿ëÇÑ 5x5 ¸¶¹æÁø ¸¸µé±â

class T0207_27//5Çà5¿­ ¸¶¹æÁø
{
     static void print(int[][] A){
          int i,j;
          for(i=0;i<A.length;i++){
               for(j=0;j<A[i].length;j++){
                     System.out.printf("[%02d]",A[i][j]);//Çü½ÄÈ­µÈ Ãâ·Â printf ()
               }
               System.out.println();
          }
     }

     public static void main(String[] args)
     {
          int i,J,K,NMG;
          int[][] A = new int[5][5];

          i=0;//ÇÁ·Î±×·¥ »óÀ¸·Î´Â 0¹øºÎÅÍ ½ÃÀÛÀÌ´Ï 0À¸·Î ÃʱâÈ­
          J=2;
          for(K=1;K<=25;K++){
               A[i][J]=K; // A[0][2]=1
               NMG=K-(int)(K/5)*5;// 5ÀÇ ¹è¼öÀÎÁö ÆǺ° // °ýÈ£·Î Çüº¯È¯ ÇØÁÖ±â!
               if(NMG==0){
                     i=i+1;
               }else{
                     i=i-1; //(-1Çà,+1¿­)
                     J=J+1;
                     if(i<0){
                     i=4;
                     }
                     if(J>4){//À̰͵µ ÇÁ·Î±×·¥ »ó 4
                          J=0;
                          }
                     }
          }
          print(A);


          System.out.println("Hello World!");
     }
}