जॉइन Examsbook
851 0

प्र: How do you traverse through a collection using its Iterator?

  • उत्तर देखेंउत्तर छिपाएं
  • Workspace

उत्तर :
व्याख्या :

To use an iterator to traverse through the contents of a collection, follow these steps: - Obtain an iterator to the start of the collection by calling the collections iterator() method. - Set up a loop that makes a call to hasNext(). Have the loop iterate as long as hasNext() returns true. - Within the loop, obtain each element by calling next().

क्या आपको यकीन है

  त्रुटि की रिपोर्ट करें

कृपया संदेश दर्ज करें
त्रुटि रिपोर्ट सफलतापूर्वक जमा हुई