package example;
import java.util.ArrayList;
import java.util.Iterator;
public class anaBolum {
    public static void main(String[] args) {
        ArrayList<IMeyveler> list = new ArrayList<>();
        list.add(new Muz());
        list.add(new Elma());
        Iterator it = list.iterator();
        while(it.hasNext()){
            it.next().fiyat() //compile error
        }
    }
}
I was use list.iterator() to access the list elements. But I can't access this method fiyat() in the iterator because I get compile error.
 
     
     
     
    