Answer C
public static void main(String[] args) {
int nums1[] = {1, 2 ,3};
int nums2[] = {1, 2, 3 ,4 ,5};
nums 2 = nums 1; // not defined. The variable has a space between nums and 2
for (int i : nums2) {
System.out.print(i + ":");
}
}
Tested code provided by rachuk
Even though both arrays have different sizes, there's no problem in reassigning their variables. Variables are still nothing else than references to objects.
B is corrent, in line 3 "nums2" becomes a reference of "nums1".
upvoted 2 times
...
Log in to ExamTopics
Sign in:
Community vote distribution
A (35%)
C (25%)
B (20%)
Other
Most Voted
A voting comment increases the vote count for the chosen answer by one.
Upvoting a comment with a selected answer will also increase the vote count towards that answer by one.
So if you see a comment that you already agree with, you can upvote it instead of posting a new comment.
MPignaProTech
2 months, 2 weeks agoreenarani04325
4 months, 1 week agoyanoolthecool
1 year, 1 month agoTerry8420
1 year, 4 months agoManuTov
1 year, 4 months agoSreeni_A
1 year, 4 months agopbbvr
1 year, 5 months agopbbvr
1 year, 5 months agodsms
1 year, 5 months agoyanoolthecool
1 year, 1 month agoKolodets
1 year, 8 months agojackymak
1 year, 6 months agoGaelBernard
1 year, 8 months agoVicky_65
1 year, 9 months agoCreazyyyyGirl
1 year, 10 months agorachuk
1 year, 11 months agoAnnie432
1 year, 11 months agoakbiyik
2 years, 1 month agoiSnover
2 years, 3 months ago