title: Print hollow rectangle with a 2 dimensional array
body: <p>I have this code that prints a rectangle using a 2 dimensional array. As you can see I hand-coded the whole array instead of using a loop. What I am looking for is:</p>
  
  <ol>
  <li>How to use a loop to print exactly the same rectangle (with the stars, minuses...)</li>
  <li>After this template is created, if I want to place, let's say a char '?' inside the rectangle, I can, for example, call the coordinates tab[5][4], and this will print it.</li>
  </ol>
  
  <p>The problem  is  a whole column of '?' is printed outside the template. How can I fix this?</p>
  
  <p>NOTE: I don't want to use any of java's Swing or AWT Libraries.</p>
  
  <pre><code>public class HelloWorld{
  
   public static void main(String []args){
  char [][] tab= {
      {'*', '-', '-', '-', '-','*'},
      {'+', ' ',  ' ',  ' ', ' ',  '+'},
      {'+', ' ',  ' ',  ' ', ' ',  '+'},
      {'+', ' ',  ' ',  ' ', ' ',  '+'},
      {'+', ' ',  ' ',  ' ', ' ',  '+'},
      {'+', ' ',  ' ',  ' ', ' ',  '+'},
      {'+', ' ',  ' ',  ' ', ' ',  '+'},
      {'*', '-', '-', '-', '-','*'}
  
  
  };
  int row=8;
  int col=6;
  for (int i=0; i&lt; row; i++){
      for(int j=0; j&lt; col; j++){
          System.out.print(tab[i][j]+" ");
  
      }
      System.out.print(tab[5][4]='?');
      System.out.println("");
  
  }
  </code></pre>
  
  <p>This is my output:</p>
  
  <pre><code>* - - - - - * ?
  +           + ?
  +           + ?
  +           + ?
  +           + ?
  +        ?  + ?
  +           + ?
  * - - - - - * ?
  </code></pre>
  
  <p>Thanks for your help</p>