Doing header with columns Code Answer

Hello Developer, Hope you guys are doing great. Today at Tutorial Guruji Official website, we are sharing the answer of Doing header with columns without wasting too much if your time.

The question is published on by Tutorial Guruji team.

can someone explain me why this line of code:

System.out.printf("%-6s", "Num", "%-10s", "Nome", "%-18s", "Idade Automóvel", "%-15s", "Total de Prémios");

Does this:


Instead of this:

Num    Nome     Idade Automóvel     Total de Prémios


Only first argument represents formatting all other arguments are just data to be used in places as speciffied with format string. You should write it like this:

System.out.printf("%-6s %-10s %-18s %-15s", "Num", "Nome", "Idade Automóvel", "Total de Prémios");
We are here to answer your question about Doing header with columns - If you find the proper solution, please don't forgot to share this with your team members.

Related Posts

Tutorial Guruji