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

Reply

Join Date: Oct 2004
Posts: 5
Reputation: javaLearner is an unknown quantity at this point 
Solved Threads: 0
javaLearner's Avatar
javaLearner javaLearner is offline Offline
Newbie Poster

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

 
0
  #1
Oct 5th, 2004
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:
Reply With Quote Quick reply to this message  
Join Date: Aug 2004
Posts: 153
Reputation: cosi is an unknown quantity at this point 
Solved Threads: 1
cosi's Avatar
cosi cosi is offline Offline
Junior Poster

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

 
0
  #2
Oct 6th, 2004
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:
  1. public void actionPerformed(java.awt.event.ActionEvent e)
  2. {
  3. }

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.
Reply With Quote Quick reply to this message  
Join Date: Oct 2004
Posts: 5
Reputation: javaLearner is an unknown quantity at this point 
Solved Threads: 0
javaLearner's Avatar
javaLearner javaLearner is offline Offline
Newbie Poster

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

 
0
  #3
Oct 7th, 2004
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:
Reply With Quote Quick reply to this message  
Join Date: Aug 2004
Posts: 153
Reputation: cosi is an unknown quantity at this point 
Solved Threads: 1
cosi's Avatar
cosi cosi is offline Offline
Junior Poster

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

 
0
  #4
Oct 8th, 2004
Don't have the .class at the end.

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.
Reply With Quote Quick reply to this message  
Join Date: Oct 2004
Posts: 5
Reputation: javaLearner is an unknown quantity at this point 
Solved Threads: 0
javaLearner's Avatar
javaLearner javaLearner is offline Offline
Newbie Poster

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

 
0
  #5
Oct 10th, 2004
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..

:-|
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:


Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC