title: how to display two-dimensional array in rectangular output?
body: <p>This is not homework. I am a beginner (novice) java programmer, trying to read and complete the exercises at the end of ivor horton's beginning java book.</p>
  
  <p>Write a program to create a rectangular array containing a multiplication table from 1 X 1 to 12 X 12. Output the table as 13 columns with the numeric values right aligned in columns. (The first line of output will be the column headings, the first column with no heading, then the numbers 1-12 for the remaining columns. The first item in each of the succeeding lines is the row heading which ranges from 1-12.</p>
  
  <p>NOTE: I have only learned about Arrays &amp; Strings, Loops &amp; Logic, data types, variables, and calculations. I have not learned about classes and their methods and etc......so no fancy stuff please. THANKS!</p>
  
  <pre><code>public class Chapter4Exercise2 {
  
      public static void main(String[] args)
      {
  
       int[][] table = new int[12][12];
  
  
       for(int i=0; i &lt;= table.length-1; i++)
       {
          for (int j=0; j &lt;= table[0].length-1; j++)  
          {
          table[i][j] = (i + 1) * (j + 1);
          if (table[i][j] &lt; 10) 
           System.out.print("  " + table[i][j] + " ");        
          else
          if (table[i][j] &gt; 10 &amp;&amp; table[i][j] &lt; 100)          
           System.out.print(" " + table[i][j] + " "); 
          else
           System.out.print(table[i][j] + " ");       
          }
          System.out.println(" ");
       }
  
      }
  }
  </code></pre>