OK, this is just a simple example of something I'm trying to fine tune:
class A {
int x;
final int y;
public A(int a, int b) {
x = a;
y = b;
new Thread() {
public void run() {
System.out.println("x = " + x + ", y = " + y);
}}.start();
}
}
Assume someone invokes new A(1,2). Which of the might occur?
a) prints x = 1, y = 2
b) prints x = 0, y = 0
c) prints x = 0, y = 2
d) prints x = 1, y = 0
e) the thread started in the constructor throws a NullPointerException
-------------------------------
JavaMemoryModel mailing list - http://www.cs.umd.edu/~pugh/java/memoryModel
This archive was generated by hypermail 2b29 : Thu Oct 13 2005 - 07:00:38 EDT