aspose file tools*
The moose likes Beginning Java and the fly likes use of for(;;) ? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "use of for(;;) ?" Watch "use of for(;;) ?" New topic
Author

use of for(;;) ?

Prashanth Naidu
Greenhorn

Joined: Feb 13, 2004
Posts: 5
Hey all,
i dont understand what the use of a for loop in the following fashion:
for(; {....}
please clarify my doubt.. thank you
-P-
Ernest Friedman-Hill
author and iconoclast
Marshal

Joined: Jul 08, 2003
Posts: 24166
    
  30

You mean with empty slots inside the parentheses? That's a "forever" loop. If there's nothing in there, then there'e no exit condition, and so the loop goes forever.
Personally I prefer to write this as "while (true)", but "for (;;)" is OK too.


[Jess in Action][AskingGoodQuestions]
Jeffrey Spaulding
Ranch Hand

Joined: Jan 15, 2004
Posts: 149
In addition to the previous posting.
I use this form ( i also prefer while( true ) { ... } ) when i can
have many different reasons to leave a loop with
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: use of for(;;) ?
 
Similar Threads
Constructing overloading
not equal too & or operator????
Converting Xml to Java Object
Posting to bump up my count...
Splitig integers