File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes Flow control (For loop) Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Storm Applied this week in the Other Open Source APIs forum!
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "Flow control (For loop)" Watch "Flow control (For loop)" New topic

Flow control (For loop)

vinita Kh
Ranch Hand

Joined: Feb 19, 2002
Posts: 49
In the following code y its prints out
"Total 0"
instead of
"i=0 ; j =10"
"i=1" : j = 9"
"i = 2 :j = 8"
"Total 30"

[ Added UBB CODE tags ]
[ May 07, 2002: Message edited by: Jessica Sant ]
Ashish Hareet
Ranch Hand

Joined: Jul 14, 2001
Posts: 375
The total at the start of the for loop is less than 30 ( zero ) so the code never get's into the for loop & you get zero as your output .
vinita Kh
Ranch Hand

Joined: Feb 19, 2002
Posts: 49
very silly mistake!
thanks Aashish.
I agree. Here's the link:
subject: Flow control (For loop)