I am trying to print off the following table. When I run the program only 3 columns print off..am I missing something?:
static Object[][] table = null;
table = new String[PricesArray.pricesArray.size()][];
for (int i = 0; i < PricesArray.pricesArray.size(); i++) {
table[i] = new String[] {
PricesArray.pricesArray.get(i).getDate(), Double.toString(PricesArray.pricesArray.get(i).getDailyOpen()), Double.toString(
PricesArray.pricesArray.get(i).getDailyHigh()),
Double.toString(PricesArray.pricesArray.get(i).getDailyLow()),
Double.toString(PricesArray.pricesArray.get(i).getDailyClose()),
Double.toString(PricesArray.pricesArray.get(i).getVolume()),
Double.toString(PricesArray.pricesArray.get(i).getAdjClose())};
}
for (final Object[] row : table) {
System.out.format("%15s%15s%15s\n", row);
}
for (final Object[] row : table) {
System.out.format("%15s%15s%15s\n", row);
}
It looks like in the print statement you are only printing three strings from the row. Have you tried adding 4 more '%15s' to the format function or something to that extent?
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.