wood burning stoves 2.0*
The moose likes Beginning Java and the fly likes Compiler Error - Must declare abstract Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Compiler Error - Must declare abstract" Watch "Compiler Error - Must declare abstract" New topic
Author

Compiler Error - Must declare abstract

Susan Worthington
Greenhorn

Joined: Apr 19, 2001
Posts: 2
Hello,
True Java Greenhorn on deck, so go easy on me.
I am writing a TicTacToe program in my JAVA class. I am receiving the error "class TicTacToe must be declared abstract. It does not define public abstract void actionPerformed(ActionEvent) from class java.awt.event.ActionListener public class TicTacToe extends JFrame
^
1 error
I cannot resolve the error with the information I have available. Please help.
Thanks! Susan W.
Bosun Bello
Ranch Hand

Joined: Nov 06, 2000
Posts: 1510
According to the massage, it sounds like you are implementing an interface but you are not providing implementation for all the methods in the interface. The action listener interface has only one method "actionPerformed" it's abstract and you must provide it's implementation or declare your class as abstract.

Bosun


Bosun (SCJP, SCWCD)
So much trouble in the world -- Bob Marley
Manfred Leonhardt
Ranch Hand

Joined: Jan 09, 2001
Posts: 1492
Hi Susan,
It's simple. If you tell Java that your class will implement any interface (in this case ActionListener) you are required to at least put a stub of the interface method in your class or declare your class abstract.
1. Place the following method into your class.

or
2. Make your class abstract. Like the following.

Regards,
Manfred
Susan Worthington
Greenhorn

Joined: Apr 19, 2001
Posts: 2
Thanks for the quick response. I'll implement your recommendations, and see if it resovles the issue. I'll keep you updated.
Susan W.
 
Consider Paul's rocket mass heater.
 
subject: Compiler Error - Must declare abstract
 
Similar Threads
Game Tutorials -->> TicTacToe
TicTacToe in Java Applet
TicTacToe - Computer's move
TicTacToe game
tictactoe help