Hi,

I am writing a simple script, basicly i have:

String s = "A quick fox jumps over a lazy dog";

Now i want to print it like this: (like 3 words per line) ::

A quick fox
jumps over a
lazy dog

Know i know i can move the string aka the line to a array and then looping
over it whit a "for" or "while".

But is there any way i can avoid using a array maybe do it whit just
one for or while loop.

Thanks in advance,
n3red

yes there is. you can use StringTokenizer class, tokenize your string using an empty space as a token (' ' - this would be your token), and then in a while/for loop, you'd print out a new line every third iteration or so. perhaps there are other ways, but this would work as well... no arrays used. I assume, under the hood, an array is used, but you wouldn't have to go through it...

commented: Tnx +1