我正在尝试以多个标题的表格格式打印显示数据。我使用以下printf
声明:
System.out.format("%-15s %-15s %-25s %-15s %-20s %s %n", "Id", "name", "Mode", "Total weight", "Arrival loc", "Departure loc");
但是会产生以下错误:
PrintStream类型中的方法格式不适用于参数(String,String,String,String,String,String)
使用格式打印此语句的可能解决方案是什么?
答案 0 :(得分:0)
你可以发布完整的代码吗?因为System.out.format("% - 15s%-15s%-25s%-15s%-20s%s%n"," Id"," name&# 34;,"模式","总重量","到达地点","出发地点");对我来说很好。enter image description here