Suggest a feature
×

Welcome to TagMyCode

Please login or create account to add a snippet.
0
0
 
0
Language: Java
Posted by: ulkir
Added: Jul 2, 2020 2:36 PM
Modified: Jul 2, 2020 2:36 PM
Views: 105
Tags: 2d array print
  1.     public static void main(String[] args) {
  2.  
  3.         int[][] arr = new int[10][4]; //burada ArrayIndexOutOfBoundsException sebep olan ilk dizi ifadesi [2],
  4.         // eger 3 olsa exception vermez, cunku bu uzunlugu belirliyor
  5.         arr[0] = new int[]{1, 3, 5, 7};
  6.         arr[1] = new int[]{1, 3};
  7.  
  8. //        arr[2] = new int[]{6, 8, 11};
  9.                
  10.         for (int[] a : arr) {
  11.             for (int i : a) {
  12.                 System.out.print(i + " ");
  13.  
  14.             }
  15.             System.out.println();
  16.         }
  17.     }