Re: ClassCastException when casting Array from Subclass to Super Class
Posted By:
ankush_purwar
Posted On:
Tuesday, February 21, 2006 01:26 PM
It seems there is some problem with your code.
SuperClass superObj = new SubClass();
superObj = superArray[i]; /* This line will loose the object of subclass that you hava create in first step. */
subArray[i] = (SubClass) superObj;
I hope you understands now
Re: ClassCastException when casting Array from Subclass to Super Class
Posted By:
Almagest_FUTT
Posted On:
Tuesday, February 21, 2006 09:02 AM
You have Objects in your superArray that are not instances of SubClass. You can't cast in this case.