简体   繁体   中英

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();
    }

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]);
  }
}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM