public static void main(String[] args) {
// TODO Auto-generated method stub
//创建一个ArrayList实例,
ArrayList<String> al = new ArrayList<String>();
//通过add方法来想al添加元素
al.add("zhangsan");
al.add("wangwu");
al.add("lisi");
al.add("xiaopan");
al.add("dage");
//生成迭代器
Iterator it = (Iterator) al.iterator();
// 记录元素的输出的顺序
int i = 0;
while(((java.util.Iterator<String>) it).hasNext()){
String Str = (String)it.next();
(String)it.next()或it.next()提示下边这个错误
Type mismatch: cannot convert from void to String
|