Suppose B class inherits A. Then the following code works.
A ob;
ob=new B();
but the following throws an ArrayStoreException :
A ob[]=new B[2];
ob[0]=new A();
Is ob[0] a reference of type A or B ? In the first code, ob was a reference of type A and therefore was able to hold a reference of a subtype. In the second code also, ob should be able to hold a reference to both A and B