Originally posted by lavanya sankuappan:
class test {
public static void main (String[] args) {
int i = 0, j = 0, k = 0;
do
while (i++ < 3)
System.out.print(k++);
while (j++ < 3);
}}
here inner while loop prints value of k as 0,1,2
this whole output should be repeated in outer do while loop until j++<3(four times)but how come result is only 012.sorry if i have misunderstood the concept
After you finish one iteration of the do-while loop, i++ is 3, so the inner while loop isn't entered again.