daniel_g
09-22-2006, 02:23 AM
In java, I know it's possible to format words or numbers. An example would be
System.out.printf("%15s\n", word);
Which would format whatever the value of word in a space with size 15.
Somewhere I read it's possible to do the same if you are returning a value, but did not provide any examples of it. I tried:
return %15s\n,word;
//ovbiusly I'm trying to return "word", can I format it while I return it?
That doesn't work, as I get illegal start of expression as an error.
Any ideas?
System.out.printf("%15s\n", word);
Which would format whatever the value of word in a space with size 15.
Somewhere I read it's possible to do the same if you are returning a value, but did not provide any examples of it. I tried:
return %15s\n,word;
//ovbiusly I'm trying to return "word", can I format it while I return it?
That doesn't work, as I get illegal start of expression as an error.
Any ideas?