posted 20 years ago
System.out.println(a[(a=b)[3]]);
let's consider how it's interpreted.
processing of the statement start from left to right
(a=b) get's evaluated which
assigns a to the reference held by b
this means now 'a' is pointing to array {0,1,2,3}
now the computation would be a[a[3] but here lies the trick, the outer 'a' reference was held before evaluating the argument. so the outer reference prints the 4th element of the array {11,12,13,14)
try inserting the line System.out.println(a[3]) at the end, it will print 3!