Reputation: 53
import java.util.*;
import java.awt.*;
import java.awt.event.*;
import java.applet.Applet;
class Client extends Button implements Observer, ActionListener{
...
}
with the code above, when i try to compile it with jdk (v 1.7.0_17) i get the following error:
error: interface expected here
class Client extends Button implements Observer, ActionListener{
^
while on other computers it works (I've only checked it on 2 different linuxes) just fine. I'm using Windows 7 Professional 64-bit.
Upvotes: 3
Views: 370
Reputation: 1500075
java.util.Observer
most definitely is an interface.
I suspect you've got an Observer
class within the same package as Client
, which would certainly cause that problem.
Complete examples:
This compiles fine:
import java.util.*;
import java.awt.*;
import java.awt.event.*;
class Client extends Button implements Observer, ActionListener {
public void update(Observable x, Object y) {}
public void actionPerformed(ActionEvent event) {}
}
This doesn't:
import java.util.*;
import java.awt.*;
import java.awt.event.*;
class Observer {} // Awooga! Awooga!
class Client extends Button implements Observer, ActionListener {
public void update(Observable x, Object y) {}
public void actionPerformed(ActionEvent event) {}
}
Upvotes: 6