Coder's Guild Mailing List

Re: format output of an array

Posted by Benjamin Johnston on 2000-09-02

> Another solution would be to create an output string in the loop and THEN
> output after the loop using println.

While this is correct, you REALLY dont want to do this, when you can just
use System.out.print(x);

(That is, unless you've got a good reason -- in which case you'd probably
take a look at java.lang.StringBuffer)

> >hmm..it's been a while since I've played with Java, but I think instead
of
> >using the println method use the print method of System.out, this way a
new
> >line character is not added to the end of the line.  I think, but if I'm
> >wrong, Mr Johnston or Frank should know...

You're correct.

-Benjamin Johnston
s355171@xxxxxxx.xx.xxx.xx