File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
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
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Compiler Error - Must declare abstract" Watch "Compiler Error - Must declare abstract" New topic

Compiler Error - Must declare abstract

Susan Worthington

Joined: Apr 19, 2001
Posts: 2
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.


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.

2. Make your class abstract. Like the following.

Susan Worthington

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.
I agree. Here's the link:
subject: Compiler Error - Must declare abstract
It's not a secret anymore!