Tom Kelliher, CS 116
Nov. 4, 2002
Exam Friday.
Quiz, finished Lab 6.
Lab 8.
Repeatedly execute a sequence of statements .
do ... statements ... while (boolean expression);
{ }
) as long as the boolean expression is true. Similar
to the do loop except that the boolean expression is tested before the
statements are executed (and may cause the loop to terminate immediately).
while (boolean expression) statement;or
while (boolean expression) { ... statements ... }
for (initial statement; test expression; iteration expression) statement
An indexed collection of data elements, all of the same type.
[]
and the name of the array.
type [] arrayName;
new
command with the type
and size of the array or we can specify initial values enclosed in
{ }
.
arrayName = new type[size];or
arrayName = { value of element 0, value of element 1, ... }
[ ]
.
arrayName[index]
Refer to handout.