it terminates execution of the block of


It terminates execution of the block of statements in while or for loop & continues execution of the loop along with the next iteration. On the contrary to the break statement, continue does not terminate execution of the loop entirely. Instead of

  • In while loop, it jumps back to the condition.
  • In for loop, it jumps back to the increment-expression.

 

The following example illustrates a While loop along a continue statement which executes while the value of i becomes equal to three. Therefore, n takes on the values one, three, seven, & twelve.

i = 0 n = 0

while (i < 5) {

i++

if (i == 3) continue n += i

}

Request for Solution File

Ask an Expert for Answer!!
JAVA Programming: it terminates execution of the block of
Reference No:- TGS0266455

Expected delivery within 24 Hours