title: 2d Array with Rectangle() grid
body: <p>I am trying to make a grid, using a 2d array list, I want to make it with Rectangles so I can use .intersects with it, I also need it to be 95 x 95 and 95 apart, this is what I have so far but its not working because of an error.</p>
  
  <pre><code>    public static Rectangle[][] walls;
      public static void walls() {
      int wallsY = 0, wallsX =0;
      for (int i = 0; i &lt; 7; i++) {
          for (int j = 0; j &lt; 7; j++) {
              //shapeList.add(new Rectangle(wallsX, wallsY, 95, 95));
              walls[i][j] = new Rectangle(wallsX,wallsY,95,95);
              wallsY += 95;
              wallsX += 95;
  
          }
      }
  </code></pre>
  
  <p>then i use:</p>
  
  <pre><code>    for (int i = 0; i &lt; walls.length; i++) {
          for(int j =0; j &lt; walls.length; j++){
              if (intersectsBox(playerRectangle(), walls[i][j])) {
                  isInsideWalls = true;
              }   
          }
       }
  </code></pre>
  
  <p>to check if they are intersecting. But I keep getting an error which is right here: </p>
  
  <blockquote>
    <p>`Exception in thread "AWT-EventQueue-0" java.lang.NullPointerException
      at bombermangame.Game.walls(Game.java:165)  at
    bombermangame.Game.(Game.java:62)   at
    bombermangame.Menu.actionPerformed(Menu.java:98)  at
    javax.swing.AbstractButton.fireActionPerformed(Unknown Source</p>
  </blockquote>