Answer the question
In order to leave comments, you need to log in
How to output the third row in a two dimensional Java array?
Given a filled two-dimensional array, how to display only the third row? There is nothing on the internet about this issue.
public class April15 {
public static void main(String[] args) {
int[][]array = new int[][] {{2,5,2,4,3,5},
{1,5,7,4,2,6},
{3,6,11,95,45,87},
{4,6,3,6,7,2,7},
{66,33,67,87,23,13}};
}
}
Answer the question
In order to leave comments, you need to log in
public class April15 {
public static void main(String[] args) {
int[][]array = new int[][] {{2,5,2,4,3,5},
{1,5,7,4,2,6},
{3,6,11,95,45,87},
{4,6,3,6,7,2,7},
{66,33,67,87,23,13}};
for (int i = 2; i <3; i++) {
for (int j = 0; j < 6; j++) {
System.out.print(" " + array[i][j] + " ");
}
System.out.println();
}
}
}
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question