This week's book giveaway is in the Performance forum.
We're giving away four copies of The Java Performance Companion and have Charlie Hunt, Monica Beckwith, Poonam Parhar, & Bengt Rutisson on-line!
See this thread for details.
Win a copy of The Java Performance Companion this week in the Performance forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Iterator in TestNG class

 
justin hoffer
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If a class implements iterator interface, it provides next() and hasnext(). Do these next() and hasnext() get called automatically when the class's object is created?

Thanks
Justin
 
Jeanne Boyarsky
author & internet detective
Marshal
Posts: 34672
367
Eclipse IDE Java VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Justin,
Welcome to CodeRanch!

No. next() and hasNext() are not called automatically on an iterator.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic