=
is parsed as right-associative, but order of evaluation is left-to-right.
So: The statement is parsed as a[i] = (i = 9)
. However, the expression i
in a[i]
is evaluated before the right hand side (i = 9
), when i
is still 0
.
It’s the equivalent of something like:
int[] #0 = a;
int #1 = i;
int #2 = 9;
i = #2;
#0[#1] = #2;
Related Contents:
- Why don’t Java’s +=, -=, *=, /= compound assignment operators require casting?
- Why does this go into an infinite loop?
- Why don’t Java’s +=, -=, *=, /= compound assignment operators require casting long to int?
- Call an array from one method to another method [closed]
- Improve nested loop efficiency and enter the xor value of the index row times the index of the column into an array using the nested loop?
- Random shuffling of an array
- How can I concatenate two arrays in Java?
- Why are arrays covariant but generics are invariant?
- Convert list to array in Java [duplicate]
- How to convert an ArrayList containing Integers to primitive int array?
- How to sort an array of objects in Java?
- Why does the toString method in java not seem to work for an array
- Resize an Array while keeping current elements in Java?
- Array or List in Java. Which is faster?
- Convert integer into byte array (Java)
- How to create correct JSONArray in Java using JSONObject
- Is an array a primitive type or an object (or something else entirely)?
- How do you find the sum of all the numbers in an array in Java?
- make arrayList.toArray() return more specific types
- Distinction between the capacity of an array list and the size of an array
- Java: join array of primitives with separator
- “Cannot create generic array of ..” – how to create an Array of Map?
- Java – Rotating array
- Variable length (Dynamic) Arrays in Java
- The easiest way to transform collection to array?
- comparing arrays in java
- Java two varargs in one method
- Error: Generic Array Creation [duplicate]
- String array initialization in Java [duplicate]
- Find the most popular element in int[] array
- How to sort an array of objects containing null elements?
- Write a mode method in Java to find the most frequently occurring element in an array
- Deep copy of an object array
- Java: Reading integers from a file into an array
- Print ArrayList
- Java Arrays.equals() returns false for two dimensional arrays
- Remove Null Value from String array in java
- Clone method for Java arrays
- Splitting String and put it on int array
- Java creating byte array whose size is represented by a long
- Java serialization of multidimensional array
- Arrays constants can only be used in initializers error
- Finding if an array contains all elements in another array
- Why does array indexing in Java start with 0?
- How are arrays implemented in java?
- All possible combinations of an array
- How to get unique items from an array?
- Generate Random Numbers in Array [duplicate]
- Cast primitive type array into object array in java
- Creating nested JSON object for the following structure in Java using JSONObject? [closed]