我正在尝试将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函数
料青山看我应如是
随时随地看视频慕课网APP
相关分类