counterserver.java

来自「Java the UML Way 书中所有源码」· Java 代码 · 共 28 行

JAVA
28
字号
/*
 * CounterServer.java   E.L. 2001-08-25
 */

import java.rmi.*;

class CounterServer {
  public static void main(String[] args) {
    try {
      System.out.println("We'll make a server object");
      YesNoCounter counter = new YesNoCounterImpl();
      System.out.println("Now it's made!");
      Naming.rebind("CountingsLtd", counter);
      System.out.println("Now we are just waiting for someone to increase our counters...");
    } catch (Exception e) {
      System.out.println("Error: " + e);
    }
  }
}
/* Example Run:
We'll make a server object
Now it's made!
Now we are just waiting for someone to increase our counters...
The number of yes votes was increased by 1
The number of no votes was increased by 1
The number of yes votes was increased by 10
The number of no votes was increased by 20
*/

⌨️ 快捷键说明

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