For Loops
by
, January 29th, 2012 at 04:57 PM (1685 Views)
The For Loop is probably the most common loop used in any programming language. Here's how it works in Java.
The For Loop takes three arguments: where you want it to start, where you want it to end, and how you'd like to increment the counter. Take a look at the below For Loop setup.
for(int counter=1; counter<=10; counter++)
What this is saying is that it's going to start at 1. It's going to keep running until it reaches 11 (that's ten iterations). And it's going to increment the counter by one each time. Pretty simple.