15.6.5
Evaluation Order for Other Expressions
EXPRESSIONS
If evaluation of an argument expression completes abruptly, no part of any
argument expression to its right appears to have been evaluated.
Thus, the example:
class Test {
static int id;
public static void main(String[] args) {
try {
test(id = 1, oops(), id = 3);
} catch (Exception e) {
System.out.println(e + ", id=" + id);
}
}
static int oops() throws Exception {
throw new Exception("oops");
}
static int test(int a, int b, int c) {
return a + b + c;
}
}
prints:
java.lang.Exception: oops, id=1
because the assignment of
3
to
id
is not executed.
15.6.5 Evaluation Order for Other Expressions
The order of evaluation for some expressions is not completely covered by these
general rules, because these expressions may raise exceptional conditions at times
that must be specified. See, specifically, the detailed explanations of evaluation
order for the following kinds of expressions:
class instance creation expressions ( 15.8.1)
array creation expressions ( 15.9.1)
method invocation expressions ( 15.11.4)
array access expressions ( 15.12.1)
assignments involving array components ( 15.25)
310
footer
Our partners:
PHP: Hypertext Preprocessor Best Web Hosting
Java Web Hosting
Inexpensive Web Hosting
Jsp Web Hosting
Cheapest Web Hosting
Jsp Hosting
Cheap Hosting
Visionwebhosting.net Business web hosting division of Web
Design Plus. All rights reserved