counterserver.java

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

JAVA
25
字号
/*
 * CounterServer.java   E.L. 2001-08-25
 *
 * Here is the main() program at the server side.
 */

import java.rmi.*;

class CounterServer implements Constants {
  public static void main(String[] args) {
    try {
      System.out.println("Status at the server side.");
      YesNoCounterFront counter = new YesNoCounterFrontImpl();
      System.out.println("Now the counter is made.");
      Naming.rebind(counterName, counter);
      System.out.println("Now we're just waiting for someone to update our counters...");
    } catch (RemoteException e) {
      System.out.println("Error in main() at the server side: " + e);
    } catch (java.net.MalformedURLException e) {
      System.out.println("Invalid URL: " + counterName);
    }
  }
}

⌨️ 快捷键说明

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