-1

I am trying to print display data in a tabular format with multiple headers. I am using the following printf statement:

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

But that generates the following error:

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

What could the possible solution to print this statement with formatting?

ChrisGPT was on strike
  • 127,765
  • 105
  • 273
  • 257
SN1586
  • 1

1 Answers1

0

can you post full code. Because the System.out.format("%-15s %-15s %-25s %-15s %-20s %s %n", "Id", "name", "Mode", "Total weight", "Arrival loc", "Departure loc"); works fine for me.enter image description here