2017-08-23 92 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