advanced for loop: foreach not applicable for expression type

p.s.v.main(String args[]){

Basket<Fruit> b =new Basket<Fruit> ();

b.setElement(new Apple());

for(Object o: b)// compiler error.

//foreach not applicable for expression type

System.out.println(o);

}

could you please explain why the for loop is causing error.

Thanks

[552 byte] By [ramkria] at [2007-11-27 6:20:29]
# 1
Is Basket an Iterable?
georgemca at 2007-7-12 17:35:43 > top of Java-index,Java Essentials,New To Java...