Its been years since I've used Java, this one is stumping me...
I implemented my own Observer/Observable interfaces for use with a 2-way RMI setup(I'm sure theres a better name but I don't know it yet).
I have 2 interfaces ToyStore and ToyFactory. ToyStore extends Remote implements Observer, ToyFactory extends Remote implements Observable. I then have a Server class that implements ToyFactory and a Client class that implements ToyStore(I won't post the code for these 2 yet, I don't think its the problem but if need be I can post).
This is what I get when I compile:
$ javac -d ./test Client.java Server.java Observable.java Observer.java ToyFactory.java ToyStore.java
ToyFactory.java:7: '{' expected
extends Remote
^
ToyStore.java:7: '{' expected
extends Remote
^
2 errors
Observer.java
package toys;
public interface Observer
{
public void update(Observable o);
}
Observable.java
package toys;
public interface Observable
{
public void addObserver(String s);
}
ToyStore.java
package toys;
import java.rmi.Remote;
import java.rmi.RemoteException;
public interface ToyStore
extends Remote
implements Observer
{
String sayHi() throws RemoteException;
public void update(Observable o) throws RemoteException;
}
ToyFactory.java
package toys;
import java.rmi.Remote;
import java.rmi.RemoteException;
public interface ToyFactory
extends Remote
implements Observable
{
String sayHello() throws RemoteException;
public void addObserver(String s) throws RemoteException;
}
Am I compiling this wrong? Am I allowed to extend and implement in an interface? Does extending Remote block me from Implementing Observer/Observable? Missing semicolon? Let me know if I need to post the other 2 files...Thanks for the help.