title: In Java, how would I print a 2d array that resembles a seating chart with an 'aisle' down the middle?
body: <p>I am working on an assignment where I have to print a 2d array that resembles a seating chart. Each element has a number, and increases in number when you go through the array, and also has an "aisle" down the middle where no one can sit. Below is what the array should look like.</p>
  
  <pre><code>1  2  3  x 4  5  6 
  7  8  9  x 10 11 12
  13 14 15 x 16 17 18
  19 20 21 x 22 23 24
  </code></pre>
  
  <p>This would continue until there are 48 total seats. This would make it have 8 rows and 7 columns.</p>
  
  <p>Right now my code is bad. I tried to make the code that would substitute the fourth column of the code with xs, but that did not work. Here is what my code looks like so far. My code only prints 0s when it runs. How would I make my code actually print the xs, and could I have some pointers on how to make each element display its respective number?</p>
  
  <pre><code>public class airplane {
  
      public static void main(String[] args) {
          int[] rows = new int[8];
          int[] columns = new int[7];
  
          int[][] chart = new int[rows.length][columns.length];
  
          for(int j = 0; j &lt; rows.length; j++)
          {
              for(int k = 0; k &lt; columns.length; k++)
              {
                  if(columns.length == 4)
                  {
                      chart[j][k] = 'x';
                  }
                  System.out.print(chart[j][k] + " ");
              }
              System.out.println();
          }
  
      }
  }
  </code></pre>
  
  <p>I apologize if my code is bad. I am inexperienced, and I do not have much help at all right now.</p>