Actually...
Apple[]
is a subclass of Fruit[]! That's how arrays work in
Java.
But here you haven't created an Apple[] object; you created a Fruit[] object with Apple objects in it. Apple[] and Fruit[] are two different classes with different capabilities; for example, a Fruit[] can hold Pear and Orange objects, while an Apple[] can not. A cast can
never change the actual class of an object; it can only tell the compiler something about the true type that it doesn't realize.
If we do actually create an Apple[], then your program works fine:
Fruit[] a=new Apple[]{new Apple(),new Apple()};
Apple[] d=(Apple[])a;