String result = String.format("% % % | %-20s| %25s | $%,8.2f | %5d | %-s", thisYear, thisMonth, thisDay,
eventName, eventVenue, ticketPrice, ticketsRemaining, eventType);
ints:thisYear,thisMonth,thisDay,ticketsRemaining。這個String格式化程序行有什麼問題?
字符串:eventName,eventVenue,eventType。
double:ticketPrice。
我已驗證所有字段已正確初始化。此行應輸出格式爲:
2012-01-20 | Penguins-Capitals | CONSOL Energy Center | $ 92.35 | 15 | NHL
2012-08-05 | Chickenfoot | Riverplex Amphitheatre | $ 62.50 | 1,273 | Concert
格式化是不完整的,但我得到的失敗,當我嘗試運行它,所以有一些語法錯誤在那裏。格式化程序我不太好。
什麼樣的故障? – Alfabravo