I want to print variables in two columns, but I need to nicely print them. What I have is:
Imagine var1
and var2
are string that will be change according to user Input throughout the program. The length of var1
will affect the position of var2, so the position of var2 will not be parallel. So is there a java method that can customize the print format?
What I want: I want to make sure that both columns will be listed in parallel manner regardless the length of them
What I hace tried so far: System.out.printf("%s %13s\n", var1, var2);
1)apple 1)bad fruit
2)orange 2)good fruit
3)pig 3)animal <----- off