Iterate through a generic List java
<p>Hi I am stuck at how to iterate through a generic list using iterator.</p>

<p>for example i hve something like this:</p>

<pre><code>public class a{
     protected int _b;
     protected String _c;
     protected float _d;
     protected int _e;
public a(int b, String c, float d, int e){
            // assign value _b,_c,_d,_e
}

     static class ab implement Iterable&lt;a&gt;{
           public static List myList = new ArrayList(a);
           public static void addlist(a f){
                   myList.add(f);
           public Iterator&lt;a&gt; iterator(){
                   return myList.iterator()}// overriding List iterator method
</code></pre>

<p>then in main method i assign value for _b,_c,_d,_e by creating instances of class a and add it to myList but when i use the iterator it doesnt show the list but it shows the memory location( i guess)of that list. I want it to show all the field in class a one by one. any suggestion what i should do ???</p>
