26 August, 2012

Flow Controls In JAVA

Flow Controls :

The following are keywords used to control the flow through a block of code:

break - Exits from the block of code in which it resides.
case - Executes a block of code, dependent on what the switch tests for.
continue - Stops the rest of the code following this statement from
executing in a loop and then begins the next iteration of the loop.
default - Executes this block of code if none of the switch-case
statements match.
do - Executes a block of code one time, then, in conjunction with the
while statement, it performs a test to determine whether the block should
be executed again.
else - Executes an alternate block of code if an if test is false.
for - Used to perform a conditional loop for a block of code.
if - Used to perform a logical test for true or false.
instanceof - Determines whether an object is an instance of a class,
superclass, or interface.
return - Returns from a method without executing any code that follows
the statement (can optionally return a variable).
switch - Indicates the variable to be compared with the case statements.
while - Executes a block of code repeatedly while a certain condition
is true.

No comments:

Post a Comment