Hey,

So, I have a class that has a bunch of info, the usual set/get methods. But my question is, I'm adding them all together in another method, and I don't know how you get it all in a nice table like format, with all the columns/rows being equal and what not...

So, I have first name, last name, social security number, and when I print this out, it's like so:

Bob Parly: SSN#: 123-45-6789
Anthony Frenkstene: SSN#: 987-65-4321

So, see how it is not aligned at all? So, how can I get it to push the SSN# column out, so that it looks better/more professional?

Again, I'm using a String.format, and

public String getWorker()
    {
        return String.format("%s %s:  SSN#: %d ", firstName, lastName, SSN);
    }

Any help would be appreciated, and thanks!
Justin W.

Don't see how to delete, but if anyone else has this problem, you add the numbers between the % and the letter (Flag), so like, &2s would add 2 spaces to it, and to go the other way, you use the - sign... I ended up finding it shortly after, sorry!

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.