62,584
社区成员




class AA implements Runnable{
int i;
public void run(){
try{
Thread.sleep(5000);
i=10;
}catch(InterruptedException e){
}
}
}
public class Jion {
public static void main(String[] args) {
AA x = new AA();
Thread t = new Thread(x);
t.start();
//这里填空,使i=10,并说明理由。
System.out.println(x.i);
}
public class Jion {
public static void main(String[] args) {
AA x = new AA();
Thread t = new Thread(x);
t.start();
//这里填空,使i=10,并说明理由:等子线程中的 i=10执行完再输出。所以要让主线程等一会儿。
try {
Thread.sleep(4000);
} catch (InterruptedException e) {
e.printStackTrace();
}
System.out.println(x.i);
}
}
x.i = 10;
public class Jion {
public static void main(String[] args) {
AA x = new AA();
Thread t = new Thread(x);
t.start();
//这里填空,使i=10,并说明理由:等子线程中的 i=10执行完再输出。所以要让主线程等一会儿。
Thread.sleep(10000);
System.out.println(x.i);
}