943,491 Members | Top Members by Rank

Ad:
  • Java Discussion Thread
  • Unsolved
  • Views: 18908
  • Java RSS
Oct 5th, 2004
0

'[Class] is not abstract..' error when i use 'implements'

Expand Post »
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:
Similar Threads
Reputation Points: 10
Solved Threads: 0
Newbie Poster
javaLearner is offline Offline
5 posts
since Oct 2004
Oct 6th, 2004
0

Re: '[Class] is not abstract..' error when i use 'implements'

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:
Java Syntax (Toggle Plain Text)
  1. public void actionPerformed(java.awt.event.ActionEvent e)
  2. {
  3. }

Hope this helps!


Ed


Quote 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:
Reputation Points: 17
Solved Threads: 1
Junior Poster
cosi is offline Offline
153 posts
since Aug 2004
Oct 7th, 2004
0

Re: '[Class] is not abstract..' error when i use 'implements'

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:
Reputation Points: 10
Solved Threads: 0
Newbie Poster
javaLearner is offline Offline
5 posts
since Oct 2004
Oct 8th, 2004
0

Re: '[Class] is not abstract..' error when i use 'implements'

Don't have the .class at the end.

Just run the line
java ChatClientApplication

Hope this helps. ;-)


Ed

Quote 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

----------------------------------------------------------------------
Reputation Points: 17
Solved Threads: 1
Junior Poster
cosi is offline Offline
153 posts
since Aug 2004
Oct 10th, 2004
0

Re: '[Class] is not abstract..' error when i use 'implements'

Good point, thankyou Ed.

Turns out I did not have my CLASSPATH environment variable set correctly (set CLASSPATH=), so class files could not be found and nothing was able to run..

Thanks for help anyway..

:-|
Reputation Points: 10
Solved Threads: 0
Newbie Poster
javaLearner is offline Offline
5 posts
since Oct 2004

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in Java Forum Timeline: How to do constructors
Next Thread in Java Forum Timeline: Random Java Info





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC