> do statement java ~ Online tutorial

do statement java

The do Statement
“She would not see it,” he said at last, curtly,
feeling at first that this statement must do without explanation.
The do Statement  executes a Statement and an Expression repeatedly until the
value of the Expression is false.

Syntax:


do Statement while ( Expression ) ;


The Expression must have type boolean or Boolean, or a compile-time error
occurs.
A do statement is executed by first executing the Statement. Then there is a
choice:
• If execution of the Statement completes normally, then the Expression is evaluated.
If the result is of type Boolean, it is subject to unboxing conversion
• If evaluation of the Expression or the subsequent unboxing conversion
(if any) completes abruptly for some reason, the do statement completes
abruptly for the same reason. Otherwise, there is a choice based on the resulting
value:
• If the value is true, then the entire do statement is executed again.
• If the value is false, no further action is taken and the do statement completes
normally.
• If execution of the Statement completes abruptly,.1 below.
Executing a do statement always executes the contained Statement at least once.

Program

public static String toHexString(int i) 
{
StringBuffer buf = new StringBuffer(8);
do
 {
buf.append(Character.forDigit(i & 0xF, 16));
i >>>= 4;
}
 while (i != 0);
return buf.reverse().toString();
}




Please Give Us Your 1 Minute In Sharing This Post!
Please Give Us Your 1 Minute In Sharing This Post!
SOCIALIZE IT →
FOLLOW US →
SHARE IT →
Powered By: BloggerYard.Com

0 comments: