1for(int i = 0; i < 10; i++)
2{
3 //do something
4
5 //NOTE: the integer name does not need to be i, and the loop
6 //doesn't need to start at 0. In addition, the 10 can be replaced
7 //with any value. In this case, the loop will run 10 times.
8 //Finally, the incrementation of i can be any value, in this case,
9 //i increments by one. To increment by 2, for example, you would
10 //use "i += 2", or "i = i+2"
11}
1int [] intArray = { 10, 20, 30, 40, 50 };
2
3for( int value : intArray ) {
4 System.out.println( value );
5}
1//itemset contains variables of type <Data Type>
2for(<Data Type> item : itemset) {
3 //loop
4}
1List<String> someList = new ArrayList<String>();
2// add "monkey", "donkey", "skeleton key" to someList
3for (String item : someList) {
4 System.out.println(item);
5}