Iterator it = list.iterator();
while (it.hasNext())
{
System.out.println(it.next());
}
所有实现了Collection接口的类均可以通过Iterator遍历, List是继承自Collection的接口, 也可以这样遍历打印.
while (it.hasNext())
{
System.out.println(it.next());
}
所有实现了Collection接口的类均可以通过Iterator遍历, List是继承自Collection的接口, 也可以这样遍历打印.
while(itr.hasNext()) {
Object element = itr.next();
System.out.println(""+element);
}其实和楼上说的是一样的
如果用awt的打印功能当然可以做到
可是你的具体要求是为了什么
各位前辈能不能指教一下啊!