import java.rmi.RemoteException; import java.rmi.server.UnicastRemoteObject; public class TimeKeeperImpl extends UnicastRemoteObject implements TimeKeeper { public TimeKeeperImpl() throws RemoteException { super(); } public String currentDate() throws RemoteException { Date currentDate = new Date(); return (currentDate.getMonth() + 1) + "/" + currentDate.getDate() + "/" + (1900 + currentDate.getYear()); } public String currentTime() throws RemoteException { Date currentDate = new Date(); return currentDate.getHours() + ":" + currentDate.getMinutes() + ":" + currentDate.getSeconds(); } } |