title: Exception in thread "AWT-EventQueue-0" java.lang.ArrayIndexOutOfBoundsException: 0 2d array java
body: <p>I'm probably missing something really obvious but can any of you guys see why this produces a Exception in thread "AWT-EventQueue-0" java.lang.ArrayIndexOutOfBoundsException: 0
  I'm trying to create a 2d list of Visables objects the 2d list must only have the one column though.</p>
  
  <pre><code>public Visables[][] searchBYsong(String search) throws XPathExpressionException
  
  {
  
     MapVariableResolver vr = new MapVariableResolver() ;
     vr.setVariable("myVar",search);
     xpath.setXPathVariableResolver(vr);
  
     XPathExpression expr = xpath.compile("/music/Song[contains(songName,$myVar)]");
     nodes = (NodeList) expr.evaluate(doc,XPathConstants.NODESET);
  
  
     Visables[][] AL = new Visables[nodes.getLength()+1][0];
     for(int i = 0;i&lt;nodes.getLength();i++)
     {
         AL[i][0]= new Visables();
  
     }
     for (int i = 0; i &lt; nodes.getLength(); i++)
     {
  
  
         AL[i][0].getName(nodes.item(i).getChildNodes().item(0).getTextContent());
         AL[i][0].setArtist(nodes.item(i).getChildNodes().item(1).getTextContent());
         AL[i][0].setAlbum(nodes.item(i).getChildNodes().item(2).getTextContent());
         AL[i][0].setLocation(nodes.item(i).getChildNodes().item(3).getTextContent());
     }
  
  
     return AL;
  }
  
    public class Visables 
  {
  
  private String loaction;
  
  private String name;
  
  private String album;
  
  private String artist;
  
  public  Visables()
  {
  
  }
  
  
  @Override
  public String toString()
  {
      return name;
  }
  public void setArtist(String artist)
  {
    this.artist=artist;   
  }
  public void getName(String name)
  {
      this.name = name;
  }
  public void setAlbum(String album)
  {
      this.album = album;
  }
  public void setLocation(String location)
  {
  
   this.loaction=location;   
  }
  </code></pre>
  
  <p>}</p>