board

While Loops: A while loop executes while the condition is true, and stops executing once the condition becomes false
While Loops: With DeMorgan's law, you negate each of the operands (here, p and q) and you switch the sign
While Loops: At the start of each loop iteration, including the first
While Loops: This loop will repeat forever
While Loops: A while loop never executes the body if the boolean condition is initially false
For Loops: The ForInit is executed once only, and right before the first iteration of the for loop.
For Loops: The ForUpdate is executed once for every iteration of the for loop, and done at the end of the loop body (or action).
For Loops: At the start of each loop iteration, including the first
For Loops: The variable is not visible once the for loop finishes.
For Loops: Given for (int i; ...; ... ) { ... }, the variable i is local to the for loop body.
Misc: ++i will first increment the value, then use it; i++ first uses the value, the increments it
Misc: Recall that Java will initialize fields of a class to default values, but not variables in a method
Misc: Java will not assign values to variables declared within methods (or within blocks within methods). Also, variables can be declared within a block.
Misc: ?: can be used if both parts will return a value. For example: int x = (y<1)?5:6;.
Misc: The only difference with a System.in Scanner is the parameter passed to the constructor; all the other methods work the exact same.
Do-while loops: If the condition is initally false, a while loop will never execute the loop body, whereas the do-while loop will execute it once.
Do-while loops: See slide 48 in the slide set for chapter 6.
Do-while loops: The beginning of a do-while loop starts out do {. The end of the loop is } while ( ... ).
Do-while loops: Note that do-while loops do not evaluate the expression at the beginning of the first iteration
Do-while loops: Typically, while loops are used much more than do-while loops
Loop controls: That's what a continue statement does
Loop controls: That's what a break statement does
Loop controls: It's on the resources page
Loop controls: Although a continue starts a new iteration of the loop, Java will execute the ForUpdate part of a for loop.
Loop controls: A break immediately stops execution of the loop, and does not evaluate any parts (the boolean expression, ForUpdate, etc.)