Some points are as follows to define Iterator:
1 The Iterator interface is used to step through the elements of a
2 Iterators let you process each element of a Collection.
3 Iterators are a generic way to go through all the elements of a Collection no matter how it is organized.
4 Iterator is an Interface implemented a different way for every Collection.
It comes inside java.util package. as public interface Iterator and contains three methods:
boolean hasNext(): this method returns true if this Iterator has more element to iterate.
Object next(): return the next element in the collection until the hasNext() method return true. Its always recommended to call hasNext() method before calling next() method to avoid java.util.NoSuchElementException: Hashtable Iterator
remove(): method remove the last element return by the iterator this method only calls once per call to next().
Core Java Interview Questions
Object Oriented Programming(OOP) Questions and Answers
Collections Interview Questions
Java Exceptions Interview Questions
Java Threads Interview Questions
Collection framework in java interview questions
oops concepts with example in java
Java Serialization Interview Questions
Top 20 Core Java Interview Questions with Answers
String Interview Question in java With Example
synchronization interview questions
Java Reflection Interview question
Java Executor Framework (JDK 1.5) Interview Questions
JDK 1.7 interview Questations and Answers
Java I/O interview question with example