I have an assignment where we are required to create a User class with a toString() method. The toString method should return a string with all the information about the user. We are required to create an array of 50 User objects and print the information about each user on a separate line. The problem is, I want to keep everything in a neat table with all Strings of the same length. So for instance:
User Name Password Full Name Email
___________________________________________________________________________________________
shortUser 12345 John Smith jSmith@shortnames.com
thisUserIsLonger 1234567890 Smitty Werbenjagermanjensen Smitty@thisOneIsLong.com
I would like to keep everything aligned as it is in the above table. This would be easy in C++ since I could just use setw() to dynamically pad spaces between according to the size of the field. Is something like this possible in Java?