Yes, it certainly would.
Java (and several other languages) have a for statement which
combines the three aspects of a loop into one statement.
In general, it looks like this:
for ( initialize ; test ; change ) loopBody ;
The initialize, test , and change
are statements or expressions that (usually) perform the named action.
The loopBody can be a single statement or a block statement.
Here is an example of a for statement:
// initialize test change for ( count = 0; count < 10; count++ ) System.out.print( count + " " );
The variable count is the loop control variable.
(A loop control variable is an ordinary variable used to control the
actions of a looping structure.)
It does the same thing as this loop built using a while statement:
count = 0; // initialize
while ( count < 10 ) // test
{
System.out.print( count + " ");
count++ ; // change
}
Remember that the statement count++ means the same
as count = count + 1.