#REDIRECT [[List of programming languages by type#Curly bracket languages]]
{{msg:vfd}}
{{Redirect category shell|1=
This is a brief overview of the syntax of Java.
{{R to section}}
=== Control structures ===
==== Loops ====
while (''Boolean expression'') {
''statement(s)''
do {
''statement(s)''
} while (''Boolean expression'');
for (''initialisation'' ; ''termination condition'' ; ''incrementing expr'') {
''statement(s)''
}
==== Conditional statements ====
if (''Boolean expression'') {
''statement(s)''
}
if (''Boolean expression'') {
''statement(s)''
} else {
''statement(s)''
}
With ''else if'' arbitrarily complex ''if-then-constructions'' may be built.
if (''Boolean expression'') {
''statement(s)''
} else if (''Boolean expression'') {
''statement(s)''
} else if (''Boolean expression'') {
''statement(s)''
} else {
''statement(s)''
}
switch (''integer expression'') {
case ''constant integer expr'':
''statement(s)''
break;
...
default:
''statement(s)''
break;
}
=== Exception handling ===
try {
''statement(s)''
} catch (exception type) {
''statement(s)''
} catch (exception type) {
''statement(s)''
} finally {
''statement(s)''
}
|