alarm.java

来自「source code about voyager examples of me」· Java 代码 · 共 33 行

JAVA
33
字号
// (c) Copyright 1997-2001 Recursion Software Inc.



package examples.message;

public class Alarm implements IAlarm
  {
  public int delay( int milliseconds )
    {
    System.out.println( "delay( " + milliseconds + " )" );

    if( milliseconds < 0 )
      throw new IllegalArgumentException( "delay < 0" );

    try{ Thread.sleep( milliseconds ); } catch( InterruptedException exception ) {}
    System.out.println( "done!" );
    return milliseconds;
    }

  public static int wakeup( int milliseconds )
    {
    System.out.println( "wakeup( " + milliseconds + " )" );
    try{ Thread.sleep( milliseconds ); } catch( InterruptedException exception ) {}
    System.out.println( "done!" );
    return milliseconds;
    }

  public static Alarm newAlarm()
    {
    return new Alarm();
    }
  }

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?