Tested and got 2413
This creates a 2D array:
n[0] = {1, 3}
n[1] = {2, 4}
First for Loop (Reverse Iteration of n):
for (int i = n.length - 1; i >= 0; i--)
n.length is 2 (since it has two rows).
i starts at 1 (i.e., n.length - 1).
The loop runs from i = 1 down to i = 0.
Nested Enhanced for Loop (Iterating Over Each Row):
for (int y : n[i])
This iterates over each element in n[i].
Execution Order:
First Iteration (i = 1 → n[1] = {2, 4}):
for (int y : n[1]) prints:
2 4
Second Iteration (i = 0 → n[0] = {1, 3}):
for (int y : n[0]) prints:
1 3
public static void main(String[] args) {
int[][] n = {{1, 3}, {2, 4}};
for (int i = n.length - 1; i >= 0; i--) {
for (int y : n[i]) {
System.out.print(y);
}
}
}
This section is not available anymore. Please use the main Exam Page.1z0-808 Exam Questions
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.
DJava
Highly Voted 5 years, 2 months agoabhayshitole
5 months, 2 weeks agorasifer
Highly Voted 5 years, 1 month agoTheeOne
Most Recent 6 months agoAhmadTechie
8 months, 3 weeks agoAhmadTechie
8 months, 3 weeks agomesonjesi
9 months, 1 week agoDarGrin
10 months, 2 weeks agoa_really_reliable_programmer
11 months, 3 weeks agoOmar_Deeb
1 year agoSreeni_A
1 year agodsms
1 year agowinfred_lu
1 year, 1 month agotuyetan
1 year, 2 months agoKolodets
1 year, 3 months agoCreazyyyyGirl
1 year, 5 months agoRajeevkuamr
1 year, 7 months agoakbiyik
1 year, 8 months ago