📄 visitors.java
字号:
class Visitors extends Thread {
Visitors (Museum m, int w) {
museum = m;
groupSize = w;
}
public void run () {
// The group walks around on its own for 50 time units.
// You may need to alter this figure to suit your computer.
// They then replace all their Walkmen and leave.
// The thread dies with them.
try {sleep((int) (Math.random()*1000)+1);}
catch(InterruptedException e) {}
museum.replace(groupSize);
}
Museum museum;
int groupSize;
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -