AppSensei
AppSensei

Reputation: 8400

Output data from a user-generated multi-dimensional array

I have a multi-dimensional array with 5 rows and 5 columns. The first 5 rows are social issues. The user has to enter an integer value rate each social issue from a scale 1(lease important) to 10(very important).

How can I output the data to a table?

 for (int col = 1; col < poller[row].length; col++) {
        poller[row][col] = input.nextInt();
    }

Upvotes: 2

Views: 117

Answers (1)

Dan D.
Dan D.

Reputation: 32391

This will print your data to the console.

int length = poller.length;
for (int row = 0; row < length; row++) {
  int rowLength = poller[row].length;
  System.out.println("");
  for (int col = 0; col < rowLength; col++) {
    System.out.print(poller[row][col]);
  }
}

Upvotes: 1

Related Questions