in above code i am trying to overwrite each element of array by 0 First i overwrite each element of forArr array by 0 using for loop it gives out 0 0 0 0 so it is ok. But when i try to overwrite each element of enhancedForArr by 0 using enhanced for loop it gives output 0 0 3 0
This really is interesting! I am just now trying to understand this very issue (the 'deep' differences between for and enhanced for - if there are any) and this exercise brought out something interesting that would have escaped my attention and understanding. Thanks for the exercise and for Wise's explanation!