Summary
In this chapter, we learned about how Java code is organized into blocks as defined by an opening and closing brace. The blocks can be an entire class, each method in the class, and a body of iteration and decision statements. From there, we learned how to classify lines of code as statements or expressions.
Operators were the next topic. We reviewed the math and logic operators and how they are combined. The cast
operator for converting from one type to another was also shown.
Next up were the two most common coding structures: iterations and decisions. The classic for
loop, a loop where the number of iterations is known before the loop begins, was presented. The second style of loops was while
and do
/while
loops. These loops do not know how many iterations there will be. This is determined in the repeating block of code.
Decision-making was next up. We looked at the if
and if
/else
statements. These are effectively the same as found in any language that traces its...