February 2014
Beginner
1248 pages
62h 25m
English
• The enhanced for statement (p. 262) allows you to iterate through the elements of an array or a collection without using a counter. The syntax of an enhanced for statement is:
for (parameter : arrayName) statement
where parameter has a type and an identifier (e.g., int number), and arrayName is the array through which to iterate.
• The enhanced for statement cannot be used to modify elements in an array. If a program needs to modify elements, use the traditional counter-controlled for statement.
Read now
Unlock full access