I was trying to print out the table data in a particular format like the one I have attached below.
System.out.printf("%10s %10s %10s %10s %10s \n", "STUDENT ID", "EMAIL ID", "NAME", "AGE", "GRADE");
Increase the x
in %xs
to increase the spaces.
Apply loop for the hyphens (-
)
and loop over your result from db in a similar way to the snippet above.