Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Java Applet

Status
Not open for further replies.

FoxStudent

Technical User
Feb 24, 2000
85
GB
Can anyone explain to me what the following error message means and how to solve it.
Temperature.java:5: Temperature should be declared abstract; it does not define actionPerformed(java.awt.event.ActionEvent) in Temperature
public class Temperature extends Applet implements ActionListener

thank u
Grainne
 
Hi,

Your have specified that the Temperature class implements the java.awt.event.ActionListener interface.
The only abstract method of this interface is actionPerformed(java.awt.event.ActionEvent), that you have to implement in Temperature.

It seems that you did not implement this method in Temperature, this is why the compiler tell you that since there is an abstract method(inherited from ActionListener) in Temperature, this class should be declared abstract.

An abstract method is a method that have no implementation, you just have its definition, interfaces in Java are classes which methods are all abstract and public.
An abstract class is a class that have at least one abstract method, due to that, it cannot be instantiated.

So just implement actionPerformed in Temperature! And it will work!

Bye.

--
Globos
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top