hi, i have an array of objects only when i print to the screen if any of the names have 6 or more charcters in it when it prints out, all those over 6 characters make the next colum move to the right, so they are not all nested neatly under each others. Does any one have any idias how to solve this?
The tab character spaces over to the next multiple of 8 plus 1. So a short name spaces over to 9, a longer name spaces over to 17. (Some environments use values other than 8, eg your editor might use 4.)
I'd probably solve this by picking a length to use for all names and manually padding with spaces. Something like this will do:
name = (name + TEN_SPACES).substring(0, 10); println( name );
The second or third time I had to do it, I might want to make a set of generic padding methods: