source:
trunk/gcc/libjava/testsuite/libjava.lang/err5.java
Last change on this file was 2, checked in by , 22 years ago | |
---|---|
|
|
File size: 1.6 KB |
Line | |
---|---|
1 | /*--------------------------------------------------------------------------*/ |
2 | /* file_name : err5.java */ |
3 | /* : */ |
4 | /* Cause : Evaluation order of method argument is not correct. */ |
5 | /* : */ |
6 | /* Message : NG */ |
7 | /* : a:[1]-->[2] */ |
8 | /* : b:[3]-->[3] */ |
9 | /* : c:[2]-->[2] */ |
10 | /* : */ |
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 | /*--------------------------------------------------------------------------*/ |
16 | |
17 | public class err5 { |
18 | public static void main(String[] args) { |
19 | int x = 1; |
20 | |
21 | err5 obj = new err5(); |
22 | obj.print(x, x = 3, x = 2); |
23 | } |
24 | |
25 | void print(int a, int b, int c) { |
26 | if ( a == 1 && b == 3 && c == 2 ) { |
27 | System.out.println("OK"); |
28 | } else { |
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+"]"); |
33 | } |
34 | } |
35 | } |
Note:
See TracBrowser
for help on using the repository browser.