summaryrefslogtreecommitdiff
path: root/libjava/testsuite/libjava.lang/err6.java
blob: 4b06c6caa7ab3c228450aea731bc3d6ced73886d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
/*--------------------------------------------------------------------------*/
/* File name  : err6.java                                              */
/*            :                                                             */
/* Cause      : Array evaluation order                                      */
/*            :                                                             */
/* Message    : NG:[1]-->[4]                                                */
/*            :                                                             */
/* Note       : JLS 15.9 Array Creation Expressions (p315--)                */
/*            :  p318 line3                                                 */
/*            :[Each dimension expression is fully evaluated                */
/*            : before any part of any dimension expression to its right.]  */
/*--------------------------------------------------------------------------*/

public class err6 {
  public static void main(String[] args) {
    int[] x = { 10, 11, 12, 1, 14 };
    int[] y = { 1, 2, 3, 4, 5, 6 };

    if ( x[(x=y)[2]] == 1 ) {
      System.out.println("OK");
    } else {
      System.out.println("NG:[1]-->[" +x[(x=y)[2]]+ "]");
    }
  }
}