perfecttimeclient.java
来自「中文JAVA编程思想第二版,一本很好的JAVA入门书籍!」· Java 代码 · 共 27 行
JAVA
27 行
//: c15:ejb:PerfectTimeClient.java
// From 'Thinking in Java, 2nd ed.' by Bruce Eckel
// www.BruceEckel.com. See copyright notice in CopyRight.txt.
// Client program for PerfectTimeBean
public class PerfectTimeClient {
public static void main(String[] args)
throws Exception {
// Get a JNDI context using
// the JNDI Naming service:
javax.naming.Context context =
new javax.naming.InitialContext();
// Look up the home interface in the
// JNDI Naming service:
Object ref = context.lookup("perfectTime");
// Cast the remote object to the home interface:
PerfectTimeHome home = (PerfectTimeHome)
javax.rmi.PortableRemoteObject.narrow(
ref, PerfectTimeHome.class);
// Create a remote object from the home interface:
PerfectTime pt = home.create();
// Invoke getPerfectTime()
System.out.println(
"Perfect Time EJB invoked, time is: " +
pt.getPerfectTime() );
}
} ///:~
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?