📄 corrupteddate.java
字号:
public class CorruptedDate{
protected static int DISPLAY=1,CHANGE=2;
private WorkThread slowThread=null;
private WorkThread fastThread=null;
private int number=0;
public CorruptedDate()
{
number=(int)(10*Math.random());
slowThread=new WorkThread(this,DISPLAY);
fastThread=new WorkThread(this,CHANGE);
}
public void performWork(int type)
{
if(type==DISPLAY)
{
System.out.print("Number before sleep is"+number);
try{
slowThread.sleep(200);
}
catch(InterruptedException e)
{
}
System.out.print("Number after sleep is"+number);
}
if(type==CHANGE)
number=-1;
}
public static void main(String[] args) {
CorruptedDate cd=new CorrupedDate();
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -