Topic: JAVA小问题 (Enumeration .elements() .hasMoreElements())

  Print this page

1.JAVA小问题 (Enumeration .elements() .hasMoreElements()) Copy to clipboard
Posted by: jjfzzy
Posted on: 2005-05-19 13:33

请尽量用准确的文字描述作为标题
Your next post without a proper Subject will be removed.

http://java.sun.com/j2se/1.4.2/docs/api/java/util/Enumeration.html



public void synchronizeCalendarService(){
Enumeration enum = calendarService.elements();
while(enum.hasMoreElements()){
((CalendarService)enum.nextElement()).synchronize();
}
}
这个代码中的 Enumeration是什么类型?.elements()和enum.hasMoreElements()上什么意思啊?哪位大哥告诉下谢谢

2.Re:JAVA小问题 [Re: jjfzzy] Copy to clipboard
Posted by: leon0122
Posted on: 2005-05-19 16:41

Enumeration 是个集合类
.elements()是取得该集合对象的下一个元素,
enum.hasMoreElements()是判断是否还有下一个元素

3.Re:JAVA小问题 (Enumeration .elements() .hasMoreElements()) [Re: jjfzzy] Copy to clipboard
Posted by: jjfzzy
Posted on: 2005-05-20 13:58

谢谢


   Powered by Jute Powerful Forum® Version Jute 1.5.6 Ent
Copyright © 2002-2021 Cjsdn Team. All Righits Reserved. 闽ICP备05005120号-1
客服电话 18559299278    客服信箱 714923@qq.com    客服QQ 714923