wood burning stoves*
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 Android Security Essentials Live Lessons this week in the Android 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.
It is sorta covered in the JavaRanch Style Guide.
subject: Flow control (For loop)
Similar Threads
Flow Control
For loop / variable ?
Please tell me why it prints 0
for loop
problem about for loop