Ask your own question, for FREE!
Computer Science 21 Online
SourMunchkin7806:

Assume an array of integers named arrNum has been properly declared and initialized. Which of these code segments will result in displaying the same output? ``` int i = 0; while (i < arrNum.length) { System.out.println(arrNum); i++; } for (int i = 0; i <= arrNum.length; i++) { System.out.println(arrNum); } for (int a : arrNum) { System.out.println(a); } ``` I and II only II and III only I and III only All three print the same results. All three print different results.

Ultrilliam:

close, put the backticks one line up, and one line down

SourMunchkin7806:

Hooya

SourMunchkin7806:

I have 1 and 3

Ultrilliam:

I think all 3 would actually print out the same results

SourMunchkin7806:

Ooof so i was kinda right aha

Ultrilliam:

All three are loops that throw out the number at the current iteration

SourMunchkin7806:

Ok

Can't find your answer? Make a FREE account and ask your own questions, OR help others and earn volunteer hours!

Join our real-time social learning platform and learn together with your friends!
Can't find your answer? Make a FREE account and ask your own questions, OR help others and earn volunteer hours!

Join our real-time social learning platform and learn together with your friends!