How to print data from a jagged array by using for each loop
How to print data from a jagged array by using for each loop
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
VulpesPosted Mar 19, 2014, 4:55 PM
http://www.c-sharpcorner.com/Forums/Thread/249315/how-to-use-jagged-array-in-java.aspx
for(int i = 0; i < 4; i++)
{
for(int j = 0; j < i + 1; j++)
{
System.out.print(jagged[i][j] + " ");
}
System.out.println();
}
The output is:
0
1 2
3 4 5
6 7 8 9