📄 timer3.java
字号:
// (c) Copyright 1997-2001 Recursion Software Inc.
package examples.timer;
import com.recursionsw.lib.timer.*;
public class Timer3
{
public static void main( String args[] )
{
SleepyHead sleepy1 = new SleepyHead();
SleepyHead sleepy2 = new SleepyHead();
System.out.println( "notify after 3 seconds with separate threads" );
Timer timer = new Timer();
timer.addTimerListener( new TimerListenerThread( sleepy1 ) );
timer.addTimerListener( new TimerListenerThread( sleepy2 ) );
timer.alarmAfter( 3000 );
System.out.println( "main program sleeps for 10 seconds..." );
try{ Thread.sleep( 10000 ); } catch( InterruptedException exception ) {}
System.out.println( "main program terminates" );
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -