for loop format

Ok so everybody knows the standard for loop format of:

for (initialization; termination; increment)

but what does it mean when you add a 4th expression to the mix?

this is from the Java Tutorial 4th Edition pg. 250

for (int i = 0; n = elements.length; i < n; i++)

Can somebody explain this please?

[338 byte] By [thousea] at [2007-11-27 8:46:48]
# 1
Good luck getting that to compile.
jverda at 2007-7-12 20:50:07 > top of Java-index,Java Essentials,New To Java...
# 2
does that mean that I'm looking at a typo?
thousea at 2007-7-12 20:50:07 > top of Java-index,Java Essentials,New To Java...
# 3
> does that mean that I'm looking at a typo?Yep. The first semicolon should be a comma.~
yawmarka at 2007-7-12 20:50:07 > top of Java-index,Java Essentials,New To Java...
# 4
Perhaps you're thinking of something like this? for (int ix = 0, jx = 10; ix < 100; ix++, jx++)
jverda at 2007-7-12 20:50:07 > top of Java-index,Java Essentials,New To Java...
# 5
> Perhaps you're thinking of something like this? > for (int ix = 0, jx = 10; ix < 100; ix++,> jx++)> ok good - well what does this mean?
thousea at 2007-7-12 20:50:07 > top of Java-index,Java Essentials,New To Java...
# 6

> > Perhaps you're thinking of something like this?

> > for (int ix = 0, jx = 10; ix < 100; ix++,

> > jx++)

> >

>

> ok good - well what does this mean?

oh wait - this just means initialize 2 things before starting the loop, right? I get it now.

thousea at 2007-7-12 20:50:07 > top of Java-index,Java Essentials,New To Java...
# 7
> ok good - well what does this mean?for (initialization; termination; increment)He is just initializing and incrementing two variables.
CaptainMorgan08a at 2007-7-12 20:50:08 > top of Java-index,Java Essentials,New To Java...
# 8
This is the initialization:int ix = 0, jx = 10int ix is initialized to 0 and int jx is initialized to 10.
BigDaddyLoveHandlesa at 2007-7-12 20:50:08 > top of Java-index,Java Essentials,New To Java...
# 9
thanks to all.
thousea at 2007-7-12 20:50:08 > top of Java-index,Java Essentials,New To Java...