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

関連する問題