?? machinerush.java
字號(hào):
package synctatic;
public class MachineRush implements Runnable{
private static int a=1;
public void go(){ //this process is a
for(int i=0;i<1000;i++)
{
System.out.println(Thread.currentThread().getName()+":"+i);
Thread.yield();
}
}
public void run(){
for(int i=0;i<10;i++){
synchronized(this){ a+=i;
try{Thread.sleep(50);
}catch(InterruptedException e){throw new RuntimeException(e);}
}
}
}
public static void main(String args[])throws InterruptedException{
MachineRush machine=new MachineRush();
Thread t1=new Thread(machine);
Thread t2=new Thread(machine);
t1.start();
t2.start();
}
}
?? 快捷鍵說明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號(hào)
Ctrl + =
減小字號(hào)
Ctrl + -