Java Programming - Chapter 6 - Looping
Empty body
A block with no statements in it.
Counter-controlled loop
A definite loop.
indefinite loop
A loop in which the final number of loops is unknown.
definite loop
A loop that executes a specific number of times is a definite loop or a counted loop.
infinite loop
A loop that never ends.
for loop
A special loop that can be used when a definite number of loop iterations is required.
Loop
A structure that allows repeated execution of a block of statements.
Loop control variable
A variable whose value determines whether loop execution continues.
prefix ++ (prefix increment operator)
Adds 1 to a variable, then evaluates it.
add and assign operator ( += )
Alters the value of the operand on the left by adding the operand on the right to it.
remainder and assign operator ( %= )
Alters the value of the operand on the left by assigning the remainder when the left operand is divided by the right operand.
divide and assign operator ( /= )
Alters the value of the operand on the left by dividing the operand on the right into it.
multiply and assign operator ( *= )
Alters the value of the operand on the left by multiplying the operand on the right by it.
subtract and assign operator ( -= )
Alters the value of the operand on the left by subtracting the operand on the right from it.
Event-controlled loop
An indefinite loop is an event-controlled loop.
inner loop
Contained entirely within another loop.
outer loop
Contains another loop.
Decrementing
Decrementing a variable reduces its value by 1.
postfix ++ (postfix increment operator)
Evaluates a variable, then adds 1 to it.
while loop
Executes a body of statements continually as long as the Boolean expression that controls entry into the loop continues to be true.
do..while loop
Executes a loop body at least one time; it checks the loop control variable at the bottom of the loop after one repetition has occurred.
Incrementing
Incrementing a variable adds 1 to its value.
posttest loop
One in which the loop control variable is tested after the loop body executes.
pretest loop
One in which the loop control variable is tested before the loop body executes.
Iteration
One loop execution.
do-nothing loop
One that performs no actions other than looping.
Loop body
The block of statements that executes when the Boolean expression that controls the loop is true.
Priming read or priming input
The first input statement prior to a loop that will execute subsequent input statements for the same variable.
Counting
The process of continually incrementing a variable to keep track of the number of occurrences of some event.
Validating data
The process of ensuring that a value falls within a specified range.
Accumulating
The process of repeatedly increasing a value by some amount to produce a total.
Loop fusion
The technique of combining two loops into one.
prefix and postfix decrement operators
subtract 1 from a variable.
