Last change
on this file was 2, checked in by bird, 22 years ago |
Initial revision
|
-
Property cvs2svn:cvs-rev
set to
1.1
-
Property svn:eol-style
set to
native
-
Property svn:executable
set to
*
|
File size:
1.2 KB
|
Line | |
---|
1 | /*--------------------------------------------------------------------------*/
|
---|
2 | /* File name : err6.java */
|
---|
3 | /* : */
|
---|
4 | /* Cause : Array evaluation order */
|
---|
5 | /* : */
|
---|
6 | /* Message : NG:[1]-->[4] */
|
---|
7 | /* : */
|
---|
8 | /* Note : JLS 15.9 Array Creation Expressions (p315--) */
|
---|
9 | /* : p318 line3 */
|
---|
10 | /* :[Each dimension expression is fully evaluated */
|
---|
11 | /* : before any part of any dimension expression to its right.] */
|
---|
12 | /*--------------------------------------------------------------------------*/
|
---|
13 |
|
---|
14 | public class err6 {
|
---|
15 | public static void main(String[] args) {
|
---|
16 | int[] x = { 10, 11, 12, 1, 14 };
|
---|
17 | int[] y = { 1, 2, 3, 4, 5, 6 };
|
---|
18 |
|
---|
19 | if ( x[(x=y)[2]] == 1 ) {
|
---|
20 | System.out.println("OK");
|
---|
21 | } else {
|
---|
22 | System.out.println("NG:[1]-->[" +x[(x=y)[2]]+ "]");
|
---|
23 | }
|
---|
24 | }
|
---|
25 | }
|
---|
26 |
|
---|
Note:
See
TracBrowser
for help on using the repository browser.