WHAT WOULD BE PRINTED FROM EACH OF THE FOLLOWING PROGRAM SEG
Solution
The output is
14
18
explanation:
executing 1st time
while (++j<=16)//j=11
{
j++;//j=12
j=j+1;//j=13
system.out.println(++j); // j=14 gets printed
}
2nd time when loop is executed
while (++j<=16)//j=15
{
j++;//j=16
j=j+1;//j=17
system.out.println(++j); // j=18 gets printed
}
3rd time the while condition becomes false
