... the counting details are hidden from you in the enhanced for
statement:
for (int counter = 0; counter < array.length; counter++) {
total += array[counter];
}
The enhanced for
statement can be used only to obtain array elements—it ...
Get Java How to Program, Early Objects, 11th Edition now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.