Overriding same method twice from same class

Viewed 3243

I was understanding how iterator() method works with ArrayList class . In ArrayList class I found iterator() method overridden twice from same class AbstractList .

public Iterator<E> iterator() {
    return new Itr();         // Itr is an inner private class of 
                               //   ArrayList which 
                              // implements Iterator interface .
}

public Iterator<E> iterator() {
        return listIterator();
    }

But how is this possible ? There should be an error here of already defined . I am confused .

2 Answers
Related