-
func1() {
if (p) {
a;
if (q) {
b;
}
else {
c;
if (r) {
d;
}
else {
e;
}
}
f;
}
else {
g;
}
h;
}
-
func2() {
while(p) {
while(q) {
while(r) {
a;
}
}
}
}
- I know the syntax below isn't C but the repeat....until construct
executes its contents and then tests if the predicate is true, in
which case the loop is done. Otherwise the loop repeats.
func3() {
repeat
repeat
repeat
a;
until(r)
until(q)
until(p)
}
- The Java try...catch...finally syntax is
described here.
A more detailed explanation appears here .
Tricky part: According to the Java standard, you must Assume that
any exception could be thrown by the contents of the try,
catch,
and finally blocks.
func4() {
try {
a;
b;
c;
}
catch (Except1) {
d;
}
catch (Except2) {
e;
}
finally {
f;
}
}