1
如何訪問變量外線程而不使變量成爲最終變量?如何訪問變量外線程而不使變量成爲最終變量
int x=0;
Thread test = new Thread(){
public void run(){
x=10+20+20; //i can't access this variable x without making it final, and if i make it.....
//final i can't assign value to it
}
};
test.start();
我覺得這是Java和更新了標籤。 – hmjd 2013-04-08 10:53:23