Java do while, while

Posted by Pindatjuh on Stack Overflow See other posts from Stack Overflow or by Pindatjuh
Published on 2010-03-12T17:25:40Z Indexed on 2010/03/12 17:27 UTC
Read the original article Hit count: 245

Filed under:
|
|
|
|

Hello,

what behaviour can I expect when I run this code:

do while(testA) {

    // do stuff

} while(testB);

Will it behave like:

do {
    while(testA) {
        // do stuff
    }    
} while(testB);

Or:

if(testA) {
    do {
        // do stuff
    } while(testA && testB);
}

Or something totally unexpected?

I ask this question because I think this is quite ambiguous, and for other people searching on this topic, not because I am lazy to test it out.

© Stack Overflow or respective owner

Related posts about java

Related posts about do