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 controls question Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Java Interview Guide this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "controls question " Watch "controls question " New topic

controls question

Erico Doon

Joined: Feb 15, 2003
Posts: 15

the output:8,4
can you tell me why?
[Dan added the UBB codes to format the code block.]
[ March 06, 2003: Message edited by: Dan Chisholm ]

I want to pass SCJP for 1.4 !I am very grateful to you for helping me!!
Marlene Miller
Ranch Hand

Joined: Mar 05, 2003
Posts: 1391
As you step through the do loop, when you get to the expression j-- < 7, remember (or save) the current value of j, decrement j, then use the saved value of j to test j < 7. When you get to the expression i++ < 7, remember (or save) the current value of i, increment i, then use the saved value of i to test i < 7.
Here is the first time through the loop:
evaluate 9 < 4
decrement j to 8 before evaluating 9 < 7
increment i to 1
increment i to 2 before evaluating 1 < 7
I agree. Here's the link:
subject: controls question
It's not a secret anymore!