//利用多线程技术,实现输出结果:
// 15 或 0 或 10 或 0 或 7
// 7 10 10 0 7
public class ModifySecond extends Thread {
static int tol = 5;
int n;
public ModifySecond(int n) {
_____1____
}
public void run() {
try {
sleep(3000);
if(n < 0) {
if(tol == 0 || tol + n < 0) {
______2______
} else {
tol = tol + n;
}
} else {
_____3______
}
System.out.println(tol);
} catch(Exception exc) {
System.out.println(exc.toString());
}
}
public static void main(String [] args) {
ModifySecond modifsecond1 = new ModifySecond(-8);
ModifySecond modifsecond2 = new ModifySecond(10);
modifsecond1.start();
modifsecond2.start();
}
}
就是在 1 2 3这三个空格处填空
|
|