public class Q implements Runnable {
int i=100;
public void run(){
while(true){
if(i>0){
System.out.println(i);
i--;
}
}
}
}
public class W {
public static void main(String[] args) {
Q q=new Q();
new Thread(q).start();
new Thread(q).start();
}
}
输出后每次会打印两个100的数值是怎么回事? |
|