Enhanced for loop (for-each): Iterates through each element: for (int val : arr). Cannot modify elements or access indices.
How to apply it: Use for-each for read-only traversal; use a standard for loop when modification or indices are needed.
Course: AP Computer Science A · Unit: Array
Practice questions about Enhanced for loop (for-each) on AimFive — get rubric-based feedback showing exactly which points you earned.
AP and Advanced Placement are trademarks of College Board. AimFive is not affiliated with or endorsed by College Board.