2017-08-23 87 views
-1

我試圖以具有多個標題的表格格式打印顯示數據。我使用以下printf聲明:具有多個參數的printf語句

System.out.format("%-15s %-15s %-25s %-15s %-20s %s %n", "Id", "name", "Mode", "Total weight", "Arrival loc", "Departure loc"); 

但是,生成以下錯誤:

Method format in the type PrintStream is not applicable for the arguments (String, String, String, String, String, String)

什麼可以在可能的解決方案與格式打印這個說法?

回答

0

你可以發佈完整的代碼。由於System.out.format(「% - 15s%-15s%-25s%-15s%-20s%s%n」,「Id」,「name」,「Mode」,「Total weight」,「Arrival loc 「,」出發地點「);對我來說工作得很好。 enter image description here