Java statements build programs. Every Java class must have a body, which is made up of one or more statements. You can write different kinds of statements, including declaration and expression.
The break statement
break;
The continue statement
continue;
The do statement
do
{statements...}
while (expression);
The for statement
for (init; test; count)
{statements...}
The enhanced for statement
for (type variable : array-or-
collection)
{statements...}
The if statement
if (expression)
{statements...}
else
{statements...}
The throw statement
throw (exception)
The switch statement
switch (expression)
{
case constant:
statements;
break;
default:
statements;
break;
}
The while statement
while (expression)
{statements...}
The try statement
try
{statements...}
catch (exception-class e)
{statements...}...
finally
{statements...}
try
{statements...}
finally
{statements...}
dummies
Source:http://www.dummies.com/how-to/content/writing-common-java-statements.html
No comments:
Post a Comment