title: Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException: 9
body: <pre><code>public class ItemTable {
  private final Integer[] idT = { 1,2,3,4,5,6,7,8,9,10 };
  private final Integer[] quantityT = { 1,2,3,4,5,6,7,8,9,10 };
  
  private final String[] barcodeT = { "001" , "002", "003", "004", "005",null,null,null,null,null, };
  private final String[] nameT =  { "Milk", "Bread", "Wine", "Butter", "Potato", "Sweet Potato","Ginger" ,"Avacado", "Cucumber"};
  private final double[] perWeightT = {0.2,0.4,0.1,0.2,0.1,2,1,0.5,0,0,0};
  private final double[] perPriceT = { 1.50, 2.45, 12.95, 4.75, 2, 3.5, 12, 4, 3, 1 };
  
  private final ArrayList&lt;ItemType&gt; table = new ArrayList&lt;&gt;();
  public final ArrayList&lt;View&gt; lookUpItem = new ArrayList&lt;&gt;();
  
  public ItemTable()
  {
      for(int i = 0; i&lt; idT.length; i++)
      {
          if(barcodeT[i]!=null)
              table.add(new ItemTypeB (idT[i], nameT[i], perPriceT[i],perWeightT[i],barcodeT[i]));
          else 
          {   
              if(perWeightT[i]!=0)
              {    
                  table.add( new ItemTypeW(idT[i], nameT[i], perPriceT[i],perWeightT[i],perWeightT[i]));
                  lookUpItem.add( new View(idT[i], nameT[i], "w"));
              }
              if(perWeightT[i]==0) 
              {
                  table.add( new ItemTypeC(idT[i], nameT[i], perPriceT[i],perWeightT[i], quantityT[i] ));
                  lookUpItem.add( new View(idT[i], nameT[i], "c"));
              }
          }
  
      }
  
  }
  </code></pre>
  
  <p>The problem area is specifically at <code>table.add(new ItemTypeC)</code> around the last line of code.</p>