| | |
'[Class] is not abstract..' error when i use 'implements'
Please support our Java advertiser: Programming Forums - DaniWeb Sister Site
![]() |
G'day..
Am new to this whole object oriented stuff. But keen to learn. Am trying to compile this class but keep getting the following error when i declare anything that 'implements'. i remove the declarations and all subsequent code references and she compiles.. any ideas??
*********************START_OF_ERROR**********************
ChatClientApplication.java:6: ChatClientApplication is not abstract and does not override abstract method actionPerformed(java.awt.event.ActionEvent) in java.awt.event.ActionListener public class ChatClientApplication extends Frame implements ActionListener, Item
Listener, WindowListener
^
1 error
***********************END_OF_ERROR**********************
Cheers..
:eek:
Am new to this whole object oriented stuff. But keen to learn. Am trying to compile this class but keep getting the following error when i declare anything that 'implements'. i remove the declarations and all subsequent code references and she compiles.. any ideas??
*********************START_OF_ERROR**********************
ChatClientApplication.java:6: ChatClientApplication is not abstract and does not override abstract method actionPerformed(java.awt.event.ActionEvent) in java.awt.event.ActionListener public class ChatClientApplication extends Frame implements ActionListener, Item
Listener, WindowListener
^
1 error
***********************END_OF_ERROR**********************
Cheers..
:eek:
To implement an interface (in this case ActionListener or ItemListener), you must write all the functions that the interface provides. One such function you're missing is actionPerformed(ActionEvent). If you put this function into your ChatClientApplication class, it will stop complaining.
Put this in your class:
Hope this helps!
Ed
Put this in your class:
Java Syntax (Toggle Plain Text)
public void actionPerformed(java.awt.event.ActionEvent e) { }
Hope this helps!
Ed
•
•
•
•
Originally Posted by javaLearner
*********************START_OF_ERROR**********************
ChatClientApplication.java:6: ChatClientApplication is not abstract and does not override abstract method actionPerformed(java.awt.event.ActionEvent) in java.awt.event.ActionListener public class ChatClientApplication extends Frame implements ActionListener, Item
Listener, WindowListener
^
1 error
***********************END_OF_ERROR**********************
Cheers..
:eek:
•
•
•
•
In a world without walls or fences,
What use are Windows and Gates.
Hi Ed,
that's brilliant! Thankyou, code compiles now..
-> ha! So now of course I attempt to run it and get:
----------------------------------------------------------------------
C:\Java Chat Application WIP\My Source>java ChatClientApplication.class
Exception in thread "main" java.lang.NoClassDefFoundError: ChatClientApplication
/class
----------------------------------------------------------------------
I am not 'constructing' correctly??, i.e.
public class ChatClientApplication extends Frame implements ActionListener, ItemListener, WindowListener
and then:
//Class constructor method..
public ChatClientApplication()
{
// initialise the user interface
init();
}
and then:
//Main method to bring everything together..
public static void main(String args[])
{
new ChatClientApplication();
}
...if anyone is bored and wants to help!
:eek:
that's brilliant! Thankyou, code compiles now..
-> ha! So now of course I attempt to run it and get:
----------------------------------------------------------------------
C:\Java Chat Application WIP\My Source>java ChatClientApplication.class
Exception in thread "main" java.lang.NoClassDefFoundError: ChatClientApplication
/class
----------------------------------------------------------------------
I am not 'constructing' correctly??, i.e.
public class ChatClientApplication extends Frame implements ActionListener, ItemListener, WindowListener
and then:
//Class constructor method..
public ChatClientApplication()
{
// initialise the user interface
init();
}
and then:
//Main method to bring everything together..
public static void main(String args[])
{
new ChatClientApplication();
}
...if anyone is bored and wants to help!
:eek:
Don't have the .class at the end.
Just run the line
java ChatClientApplication
Hope this helps. ;-)
Ed
Just run the line
java ChatClientApplication
Hope this helps. ;-)
Ed
•
•
•
•
Originally Posted by javaLearner
Hi Ed,
that's brilliant! Thankyou, code compiles now..
-> ha! So now of course I attempt to run it and get:
----------------------------------------------------------------------
C:\Java Chat Application WIP\My Source>java ChatClientApplication.class
Exception in thread "main" java.lang.NoClassDefFoundError: ChatClientApplication
/class
----------------------------------------------------------------------
•
•
•
•
In a world without walls or fences,
What use are Windows and Gates.
![]() |
Similar Threads
- class linkage error in servlet (JSP)
- 3 C++ questions - destructors, derived class, abstract class (C++)
- 'Abstract Error' while closing the form (Pascal and Delphi)
- Abstract Error Message (Java)
Other Threads in the Java Forum
- Previous Thread: How to do constructors
- Next Thread: Random Java Info
| Thread Tools | Search this Thread |
Tag cloud for Java
android api apple applet application arc arguments array arrays automation binary bluetooth c++ chat class classes client code codesnippet component csv database doctype draw ebook eclipse error event exception fractal freeze game givemetehcodez graphics gui html ide image input integer intellij iphone j2me java java.xls javaprojects jmf jni jpanel julia linux list loop loops mac map method methods mobile netbeans newbie number online oracle page parameter plazmic print problem program programming project recursion reporting rotatetext scanner screen sell server set size sms socket sort sourcelabs sql string superclass swing system template test testautomation threads time title tree tutorial-sample windows working





