go to previous page   go to home page   go to next page hear noise

What will the program print if the initialization is changed to:

int count = 0;

Answer:

count is 0
count is 1
count is 2
count is 3
Done with the loop

Boundary Conditions

To determine what a loop does, look at the following:

Here is another version of the example fragment:

int count = 1;  
while ( count < 4 )  // this is different 
{
  System.out.println( "count is:" + count );
  count = count + 1;   
}
System.out.println( "Done with the loop" );      

The loop condition has been changed from the previous version.


QUESTION 8:

What does the program print out?