请教jdk5 for循环的问题
这里ThreadVO是SubjectStyleThreadVO的父类,threadList现在存放有20个ThreadVO对象,想实现将threadvoList中的对象放到subjectThreadVOList中,同事说jdk5中这种循环效率相对较高,现在运行subjectThreadVOList.add((SubjectStyleThreadVO) threadvo);报了空指针错误,大家帮我看下哪里有错,是不是更好的写法。
for(ThreadVO threadvo:threadList){ subjectThreadVOList.add((SubjectStyleThreadVO) threadvo); };