Friday, 17 January 2014

JUMP STATEMENTS OR BRANCHING STATEMENTS:return

Using return statement


return:


The return statement is used to explicitly return from a method. The return statement is used to explicitly return from the method . That is, that is it causes program control to transfer back to the caller of the method.

JUMP STATEMENTS OR BRANCHING STATEMENTS:continue


Using continue statement


continue:


 statement in java used to skip the part of the loop.Sometimes it is useful to force an early iteration of a loop.Unlike break statement it does not terminate the loop,instead it skip the remaining part of the loop and the control again goes to check the condition again.Continue statement can be used only loop control statements,

Thursday, 16 January 2014

Iteration statements : do-while

How to use java do-while:Exit control loop

Using do-while

A do-while is similar to while loop,except that a do-while loop is quaranteed to execute atleast one time. For that you have to use the do while loop in  after that check the condition then we use the do-while loop statement. do-while loop is same as the while loop statement but while loop checks the certain condition is first and if condition is true then statements or processes are executed otherwise all the statements written under the while loop is ignored by the interpreter