Shahir Deo wrote:So , iterator() method belongs to ArrayList Class
It's defined in Iterable, which Collection extends, and which therefore ArrayList implements.
which implementing Iterator Interface and object 'itr' is an instance of ArrayList?
No. There's an object that impelments Iterator, and there's a completely separate object of a completely different class that is the ArrayList. An ArrayList is not an Iterator and an Iterator is not an ArrayList.
The ArrayList class has an iterator() method which returns a reference to an object that implements Iterator. There's a class defined in the Collections Framework--probably a private nested class inside ArrayList--that implements Iterator for ArrayList. When we call ArrayList.iterator(), the ArrayList creates and returns one of these Iterator objects.