Given this code fragment:
What is the outcome?
Assigning one array variable to another copies the array reference, not the array elements. After nums2 = nums1, nums2 refers to the three-element array {1, 2, 3}, so the enhanced for loop prints 1:2:3:.
nums2 = nums1
nums2
{1, 2, 3}
for
1:2:3:
Community Discussion