I CSI 201 Chapter Notes - Chapter 4: Reverse Polish Notation, Polish Notation, Infinite Loop
Document Summary
There are numerous times where a variable must simply be incremented or decremented. number = number + 1; number = number 1; Java provides shortened ways to increment and decrement a variable"s value. Using the ++ or -- unary operators, this task can be completed quickly. number++; or ++number; number--; or --number; When an increment or decrement are the only operations in a statement, there is no difference between prefix and postfix notation. The while loop has the form: while(condition) statements; While the condition is true, the statements will execute repeatedly. The while loop is a pretest loop, which means that it will test the value of the condition prior to executing the loop. Care must be taken to set the condition to false somewhere in the loop so the loop will end. Loops that do not end are called infinite loops. A while loop executes 0 or more times. If the condition is false, the loop will not execute.