?? philopher.java
字號:
public class Philopher extends Thread
{
int i;
public Philopher(int i){
this.i=i;}
public void run(){
if (i%2==0){
Main.fork[i].P();
Main.fork[(i+1)%5].P();
System.out.println("Philopher"+i+"is eating");
Main.fork[i].V();
Main.fork[(i+1)%5].V();}
else{
Main.fork[(i+1)%5].P();
Main.fork[i].P();
System.out.println("Philopher"+i+"is eating");
Main.fork[(i+1)%5].V();
Main.fork[i].V();
}
}
}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -