The functionality of Enumeration interface is duplicated by the Iterator interface. In addition, Iterator adds an optional remove operation, and has shorter method names :1. Difference between Enumeration and Iterator interface is Enumeration has two methods hasMoreElements() and nextElement() and Iterator has three methods hasNext() and next() and remove().:1. if i want to write a method for traversing through a collection.
Category:Java Interview Questions
No comments:
Post a Comment