/** * This demo is a class capable of being used remotely. * *
* * Copyright © 1999, 2000 E. W. Grundke. All rights reserved.
* @author E. W. Grundke */ import java.rmi.*; import java.rmi.server.*; /** * This class represents a "complex number" consisting of * a "real part" and an "imaginary part". */ public class RemoteClassDemo extends UnicastRemoteObject implements RemoteInterfaceDemo { double re, im; public RemoteClassDemo (double r, double i) throws RemoteException { re = r; im = i; } public double abs() throws RemoteException { return Math.sqrt(re*re+im*im); } }