1 /*--------------------------------------------------------------------------*/
2 /* file_name : err5.java */
4 /* Cause : Evaluation order of method argument is not correct. */
11 /* Note : JLS 15.6 Evaluation Order */
12 /* S15.6.4 Argument Lists are Evaluated Left-to-Right(p309) */
13 /* [Each argument expression appears to be fully evaluated */
14 /* before any part of any argument expression to its right.] */
15 /*--------------------------------------------------------------------------*/
18 public static void main(String
[] args
) {
21 err5 obj
= new err5();
22 obj
.print(x
, x
= 3, x
= 2);
25 void print(int a
, int b
, int c
) {
26 if ( a
== 1 && b
== 3 && c
== 2 ) {
27 System
.out
.println("OK");
29 System
.out
.println("NG");
30 System
.out
.println("a:[1]-->["+a
+"]");
31 System
.out
.println("b:[3]-->["+b
+"]");
32 System
.out
.println("c:[2]-->["+c
+"]");