我正在尝试将DefaultListModel内容复制到数组中。以下行导致异常
testArray = (cGenIndicator[]) indObjList.toArray();
void testCasting() {
DefaultListModel<cGenIndicator> indObjList;
indObjList = new DefaultListModel<cGenIndicator>();
indObjList.addElement(new cGenIndicator(null, null));
cGenIndicator[] testArray;
try {
// This line causses exception saying
// [Ljava.lang.Object; cannot be cast to [LIndicator.cGenIndicator;
testArray = (cGenIndicator[]) indObjList.toArray();
} catch(Exception e) {
test++;
}
test++;
}
HUH函数
料青山看我应如是
相关分类