title: Two dimensional array 4x5 matrix
body: <p>I recently dove into Java and came across two dimensional arrays. For a while now, I'm trying to understand this code:</p>
  
  <pre><code>   int twoD[][]= new int[4][5];
  int i, j, k = 0;
  
  for(i=0; i&lt;4; i++)
  for(j=0; j&lt;5; j++) {
      twoD[i][j] = k;
   k++; }
  
  for(i=0; i&lt;4; i++) {
    for(j=0; j&lt;5; j++)
      System.out.print(twoD[i][j] + " ");
    System.out.println();
  </code></pre>
  
  <p>The output is</p>
  
  <p>0 1 2 3 4 </p>
  
  <p>5 6 7 8 9</p>
  
  <p>10 11 12 13 14 </p>
  
  <p>15 16 17 18 19</p>
  
  <p>I just can't figure out how the chronology of this code works. I understand that for each row 5 column outputs should be made, but how it this achieved in steps?</p>
  
  <p>MANY THANKS!</p>
  
  <p>Roeland
  Amsterdam</p>