JHTP11 04
JHTP11 04
statements)
◦ Perform statements repeatedly while a loop-continuation condition remains true.
while and for statements perform the action(s) in their bodies zero or more
times
◦ if the loop-continuation condition is initially false, the body will not execute.
The do…while statement performs the action(s) in its body one or more times.
Chapter 7 presents the enhanced for statement.
if, else, switch, while, do and for are keywords.
◦ Appendix C: Complete list of Java keywords.
transition arrows and final state) represent action states and decisions.
only from the line of their declaration to the closing right brace of the
method declaration.
A local variable’s declaration must appear before the variable is used in
that method.
A local variable cannot be accessed outside the method in which it’s
declared.
the number of iterations is not known before the loop begins executing.
A special value called a sentinel value (also called a signal value, a
exam for real-estate brokers. Last year, ten of the students who
completed this course took the exam. The college wants to know how
well its students did on the exam. You’ve been asked to write a program
to summarize the results. You’ve been given a list of these 10 students.
Next to each name is written a 1 if the student passed the exam or a 2 if
the student failed.