Dead
[official-gcc.git] / gomp-20050608-branch / libjava / testsuite / libjava.lang / err3.java
blob17535b8500f83d1bbd55f316fd8c66d3f38e8534
1 /*--------------------------------------------------------------------------*/
2 /* File name : err3.java */
3 /* : */
4 /* Cause : Evaluation sequence of the formula which used */
5 /* : the substitution operator is not performed correctly. */
6 /* : */
7 /* Message : NG1:[27]-->[9] */
8 /* : NG2:[27]-->[9] */
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 /*--------------------------------------------------------------------------*/
15 public class err3 {
16 public static void main(String[] args) {
17 int x = 9;
18 x *= (x = 3);
19 if ( x == 27 ) {
20 System.out.println("OK1");
21 } else {
22 System.out.println("NG1:[27]-->["+x+"]");
25 int y = 9;
26 y = y * (y = 3);
27 if ( y == 27 ) {
28 System.out.println("OK2");
29 } else {
30 System.out.println("NG2:[27]-->["+y+"]");