1 /*--------------------------------------------------------------------------*/
2 /* File name : err3.java */
4 /* Cause : Evaluation sequence of the formula which used */
5 /* : the substitution operator is not performed correctly. */
7 /* Message : NG1:[27]-->[9] */
10 /* Note : JLS 15.6 Evaluation Order (p305) */
11 /* S15.6.1 Evaluate Left-Hand Operand First */
12 /* : A formula should be evaluated to 9*3 instead of 3*3. */
13 /*--------------------------------------------------------------------------*/
16 public static void main(String[] args) {
20 System.out.println("OK1");
22 System.out.println("NG1:[27]-->["+x+"]");
28 System.out.println("OK2");
30 System.out.println("NG2:[27]-->["+y+"]");