• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Compiler Error - Must declare abstract

 
Susan Worthington
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 1511
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
Manfred Leonhardt
Ranch Hand
Posts: 1492
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks for the quick response. I'll implement your recommendations, and see if it resovles the issue. I'll keep you updated.
Susan W.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic