Java – How to use \t in my example [duplicate]

You can use System.out.format()

Example:

String project = "myProjectName";
String firstName = "firstName";
String lastName = "lastName";

System.out.format("%-20s%-15s%-15s", project, firstName, lastName);

Above code snippet should print the following formatted output:

myProjectName       firstName      lastName  

Edit:
I found this library which simplifies such kind of formatting. It is also available on Maven.

Leave a Comment