Thursday, February 14, 2013

Java Flow Control Constructs

if

if (condition)
{
   statements;
}
else
{
   statements;
}

for

for (i=0; i<100; i++)
{
}

while loop

while (condition)
{
   statements;
}

do... While loop

do
{
  statements;
}
while (condition);

switch

switch (variable)
{
  case (v1):
    statements;
    break;
  case (v2):
     statements;
     break;
  default:
     statements;
     break;
}