Campbell Ritchie wrote:You may be able to use the no-arguments toArray method and cast the resultant array.
No you may not. toArray() returns an Object[] - both in reference type and in actual type. Casting this to anything else, like Apple[], will throw a ClassCastException.