class Student{
String name;
public Student(String name){
this.name = name;
}
@Override
public String toString() {
return "Student [name = " + this.name + "]";
}
}
public class Demo{
public static void main(String[] args) {
List list = new ArrayList();
list.add(new Student("赵四"));
list.add(new Student("郭德纲"));
list.add(new Student("小沈阳"));
Iterator it = list.iterator();
while (it.hasNext()) {
it.next();
Student str = list.get((String) it.next());
System.out.println(it.next());
}
}
}
出问题了 求大神指点
|
|