title: How can I create an instance of my Iterator private class in `main()`
body: <p>What's the syntax for creating an instance of the Iterator private class in <code>main()</code>?</p>
  
  <p>I have this:</p>
  
  <pre><code>public class OuterClass implements Iterable&lt;Integer{
  
     .....
     public Iterator&lt;Integer&gt; iterator(){
         return new MyIterator();
     }
  
     private MyIterator implements Iterator&lt;Integer&gt;{
        .....
     }
  
  }
  </code></pre>
  
  <p>Inside the <code>main()</code> method, I'm trying to do something like 
  <code>MyClass.MyIterator&lt;String&gt; iter = object.iterator();</code>
  but it's not working.</p>