lobo_zhang
Welcome to the Java Ranch, we hope you�ll enjoy visiting as a regular however,
your name is not in keeping with our
naming policy here at the ranch. Please
change your display name to an appropriate name as shown in the policy.
Thanks again and we hope to see you around the ranch!!
As for your question, there is nothing strange about the code you posted:
do{
System.out.println("value of i is"+ i);
} while (--i<0);
you assign i the value of 0 and the only thing you do to it is to keep reducing the value of it, sot he condition that --i<0 will always be true and the loop will run endlessly. Maybe you have this confused with a for loop where the value of the conditional variable is incremented on every iteration. From the
JLS section 14.12 The do statement executes a Statement and an Expression repeatedly until the value of the Expression is false. In this case the expression is always true. Hope that helps.