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

📄 studentenrollment.java

📁 程序练习中包括书中实例程序代码和练习中要用到的代码,是压缩文件
💻 JAVA
字号:
package examples.network;
import java.rmi.Naming;
import java.rmi.RMISecurityManager;
/** A server-side program that creates and registers
  * StudentImpl objects with the RMI registry for use
  * by clients
  */
public class StudentEnrollment {
   public static void main( String[] args ) {
      if ( System.getSecurityManager() == null ) {
         System.setSecurityManager(
            new RMISecurityManager() );
      }
      try {
         StudentImpl[] students = {
            new StudentImpl( 1001, "Elaine Jones" ),
            new StudentImpl( 1002, "Patricia Hartswell" ),
            new StudentImpl( 1003, "Darius Smith" ),
            new StudentImpl( 1004, "Mary Bagshaw" ),
            new StudentImpl( 1005, "Henry Miller" )
         };
         for ( int i = 0; i < students.length; i++ ) {
            int id = students[i].getID();
            Naming.rebind( "Student" + id , students[i] );
         }
         System.out.println( "Student objects bound." );
      } catch ( Exception x ) {
         x.printStackTrace();
      }
   }
}

⌨️ 快捷键说明

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