Prev | Current Page 191 | Next

Carl Reynolds and Paul Tymann

"Schaum's Outline of Principles of Computer Science"

In this case, the expression declares an
int called i, and sets the value of i to 1.
The second expression in the for statement establishes a condition which will evaluate to either true or
false. When the condition is true, the code block of the for statement will be executed. In this case, as long as
the value of i is less than or equal to the number of students, the loop will execute.
The third expression in the for statement specifies what to change each time the loop is executed. This
expression is sometimes called the ???increment expression,??? because it is usually employed to change the value
of the variable being tested in the second expression. That is the case here, because the third expression says to
increment the value of the variable i each time the loop executes.
The body or code block of the for statement follows the three expressions within parentheses. In this case,
the readLine() method of the BufferedReader reads the next line of the file into a String variable
called score. Since the BufferedReader reads character strings, we must convert the characters into an
internal floating-point number before we can do our math. The last line says use the parseDouble() method
of the Double class to interpret the character string in score (e.


Pages:
179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203
teksty piosenek parasole reklamowe Everest Poker poker imprezy integracyjne dla firm