Usage of '<Class>' in ArrayList<Object> name = new ArrayList<Object>(); and an unusual for loop for(class name : object)
in
Programming Questions
•
1 years ago
I've been looking at an example phi.lo kindly wrote up
here.
There are two parts of the code that don't work for me.
Compiling stops at the above line saying unexpected token '<' I'm not even sure what it is supposed to mean. Forcing an Object unto a ArrayList?
and this construction I'm also unfamiliar with:
The only construction I'm familiar is this:
There are two parts of the code that don't work for me.
ArrayList<Drop> drops = new ArrayList<Drop>();
Compiling stops at the above line saying unexpected token '<' I'm not even sure what it is supposed to mean. Forcing an Object unto a ArrayList?
and this construction I'm also unfamiliar with:
for (LiquidLayer ll : layers)
The only construction I'm familiar is this:
for (init; test; update)I'm posting this as a speparate topic, as I believe that it is a more general question about grammar and not a particular snippet as a whole.
1