⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 productserver.java

📁 core java第二卷源代码第三章。欢迎大家下载
💻 JAVA
字号:
/**
   @version 1.10 1999-08-21
   @author Cay Horstmann
*/

import java.rmi.*;
import java.rmi.server.*;

/**
   This server program instantiates two remote objects,
   registers them with the naming service, and waits for
   clients to invoke methods on the remote objects.
*/
public class ProductServer
{  
   public static void main(String args[])
   {  
      try
      {  
         System.out.println
            ("Constructing server implementations...");

         ProductImpl p1
            = new ProductImpl("Blackwell Toaster");
         ProductImpl p2
            = new ProductImpl("ZapXpress Microwave Oven");

         System.out.println
            ("Binding server implementations to registry...");

         Naming.rebind("toaster", p1);
         Naming.rebind("microwave", p2);

         System.out.println
            ("Waiting for invocations from clients...");
      }
      catch(Exception e)
      {  
         e.printStackTrace();
      }
   }
}

⌨️ 快捷键说明

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