Yes. (Actually, a good answer would be "sounds dangerous", because it is.)
When the test part of a for
is omitted it is
as if the value true were put in its place.
So,
for ( initialize ; ; change ) loopBody ;
is the same as:
for ( initialize ; true ; change )
loopBody ;
This is done for compatibility with the language C. It should not be used in newly written programs.
Several syntactic oddities were included in Java so that it would look familiar to C programmers.
Could all three parts be omitted from a for
?