Name: ###@###.### Date: 09/05/96
a variable is not considered as definitely assigned before
the right-hand side of an assignment expression though it is
definitely assigned after an index expression within the
left-hand side of the assignment. This contradicts the following
assertion:
Suppose that an assignment expression a = b, a += b, a -= b,
a *= b, a /= b, a %= b, a <<= b, a >>= b, a >>>= b, a &= b,
a |= b, or a ^= b is not boolean-valued.
- V is definitely assigned before b iff V is definitely assigned
after a.
(Java Language Specification, section 16.1.14)
Test: compilation of the following test
public class test
{
public static void main(String argv[])
{
int [] a = {1, 2, 3, 4, 5};
int i, r;
r = (a[i = 1] = 777 + i);
System.out.println(r);
}
}
produces such diagnostics:
novo40% javac test.java
test.java:8: Variable i may not have been initialized.
r = (a[i = 1] = 777 + i);
^
1 error
======================================================================