Back
Close

Computing with Data

elgeish
33.1K views
Previous: Arrays Next: Ragged Multidimensional Arrays

Multidimensional Arrays

public class MultidimensionalArrayExample {
public static void main(final String[] args) {
final int[][] ar = new int[10][10];
for (int i = 0; i < ar.length; ++i) {
for (int j = 0; j < ar[i].length; ++j) {
ar[i][j] = i * 10 + j;
}
}
for (int i = 0; i < ar.length; ++i) {
for (int j = 0; j < ar[i].length; ++j) {
System.out.print(ar[i][j] + " ");
}
System.out.print("\n");
}
}
}
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
Create your playground on Tech.io
This playground was created on Tech.io, our hands-on, knowledge-sharing platform for developers.
Go to tech.io
codingame x discord
Join the CodinGame community on Discord to chat about puzzle contributions, challenges, streams, blog articles - all that good stuff!
JOIN US ON DISCORD
Online Participants