avatar
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!
avatar
xt
2
This is very strange. You must have sth else wrong.
avatar
xt
3

It can't be, otherwise JVM will throw LinkageError
avatar
t*t
4
recomiple everything?

【在 z****g 的大作中提到】
: 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.

avatar
z*g
5
It is a fresh compile. Really don't get it.
Anyway, I will try it.

【在 t***t 的大作中提到】
: recomiple everything?
相关阅读
logo
联系我们隐私协议©2024 redian.news
Redian新闻
Redian.news刊载任何文章,不代表同意其说法或描述,仅为提供更多信息,也不构成任何建议。文章信息的合法性及真实性由其作者负责,与Redian.news及其运营公司无关。欢迎投稿,如发现稿件侵权,或作者不愿在本网发表文章,请版权拥有者通知本网处理。