The following list summarizes the important points that were covered in this module:
- The
if
statement uses a boolean
expression and the switch
statement uses an int
expression.
- The cases of a
switch
statement must be expressions that evaluate to int
values (after promotion). The expressions must be able to be evaluated during compilation.
- Commas may be used to separate statements in the initialization and iteration parts of a
for
statement. If multiple statements are contained in the initialization part, then all variables that are declared in the initialization statements must be of the same type.
- The
do
statement executes the enclosed statement block at least once.
- The
break
statement terminates the enclosing loop or switch
statement; the continue
statement only terminates the current loop iteration.
- The
throw
statement throws objects that extend the Throwable
class. The catch
statement catches objects that extend the Throwable
class.
- The
finally
clause is executed no matter whether an exception is thrown or caught.
- An object becomes eligible for garbage collection when it becomes unreachable. When or if an object is actually garbage collected, can not be predicted.