aspose file tools*
The moose likes Beginning Java and the fly likes for-loop weird thing. Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "for-loop weird thing." Watch "for-loop weird thing." New topic
Author

for-loop weird thing.

Edward Chen
Ranch Hand

Joined: Dec 23, 2003
Posts: 798
I found something weird.


Why nothing output ? I think it should display "index=1".

Any help ?

Thanks.
marc weber
Sheriff

Joined: Aug 31, 2004
Posts: 11343

In the for loop, the boolean condition evaluates to false on the first try (when i is zero) because dddd does not contain "0". Therefore, the loop body never executes, and i is never incremented to 1.


"We're kind of on the level of crossword puzzle writers... And no one ever goes to them and gives them an award." ~Joe Strummer
sscce.org
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: for-loop weird thing.