Help! ClassCastException# Java - 爪哇娇娃
z*g
1 楼
I got a very weird exception
code:
...
//isotopes is a Vector
cdk.Isotope iso = (cdk.Isotope)isotopes.elementAt(0);
....
when it runs this line, it throws a ClassCastException
But when I printout isotopes.elementAt(0).getClass().getName()
it print out "cdk.Isotope".
Can't figure out why.
Please help!
code:
...
//isotopes is a Vector
cdk.Isotope iso = (cdk.Isotope)isotopes.elementAt(0);
....
when it runs this line, it throws a ClassCastException
But when I printout isotopes.elementAt(0).getClass().getName()
it print out "cdk.Isotope".
Can't figure out why.
Please help!