58,454
社区成员
发帖
与我相关
我的任务
分享
package Test;
import java.util.*;
public class Hzh14 {
public static void main(String[]args){
List s=new ArrayList();
StringBuffer s1=new StringBuffer("5");
Account a=new Account("abc");
Account a1=new Account("add");
s.add("1");s.add("2");s.add("3");s.add("4");s.add(s1);s.add(a);s.add(a1);
Iterator<Account> it=s.iterator(); Iterator<Object> it1=s.iterator();
int i=0;int q=0;
while(it.hasNext()){
if(i==5||i==6){System.out.print(it.next()+" ");}
else System.out.print(it.next()+" ");
i++;
}
while(it1.hasNext()){
if(q==4){ }
System.out.print(it1.next()+" ");
q++;
}
}
}