OnJava8-Examples/remote/ptime/DisplayPerfectTime.java

23 lines
600 B
Java
Raw Normal View History

2015-05-05 11:20:13 -07:00
//: remote/ptime/DisplayPerfectTime.java
// Uses remote object PerfectTime
// {RunByHand}
package remote.ptime;
import java.rmi.*;
import java.rmi.registry.*;
public class DisplayPerfectTime {
public static void main(String[] args) {
System.setSecurityManager(new SecurityManager());
try {
PerfectTimeI t =
(PerfectTimeI)Naming.lookup(
"//MindviewToshibaLaptop:2005/PerfectTime");
for(int i = 0; i < 10; i++)
System.out.println("Perfect time = " +
t.getPerfectTime());
} catch(Exception e) {
e.printStackTrace();
}
}
} ///:~