Leave a Reply 3

Your email address will not be published. Required fields are marked *


ana

ana

public class MyClass{
public static void main(String[] args) {
int nums1 [] = new int [3];
int nums2 [] = {1, 2, 3, 4, 5};
nums1 = nums2;
for(int x : nums1){
System.out.print(x + ” : “);
}
}
}

output: 1 : 2 : 3 : 4 : 5 :

renko

renko

Indeed, the anwser is A.
Reference variable nums1 is (in the loop) pointing to array object with elements (1, 2, 3,4, 5).