| Author |
why is this not compiling
|
james oberon
Greenhorn
Joined: Jan 23, 2006
Posts: 2
|
|
[ EJFH: Added CODE tags to preserve formatting. ] [ January 23, 2006: Message edited by: Ernest Friedman-Hill ]
|
 |
avelin chen
Greenhorn
Joined: Dec 11, 2005
Posts: 27
|
|
|
What does the compiler say?
|
 |
Layne Lund
Ranch Hand
Joined: Dec 06, 2001
Posts: 3061
|
|
Please post the compiler error that you get so that we can explain what the message means. Layne
|
Java API Documentation
The Java Tutorial
|
 |
Ernest Friedman-Hill
author and iconoclast
Marshal
Joined: Jul 08, 2003
Posts: 24061
|
|
Hi, Welcome to JavaRanch! Want to tell us what the compiler error message was? Sure would make this go a lot faster.
|
[Jess in Action][AskingGoodQuestions]
|
 |
james oberon
Greenhorn
Joined: Jan 23, 2006
Posts: 2
|
|
|
says lab not abstract and does not override abstract method in line number 4
|
 |
Henry Wong
author
Sheriff
Joined: Sep 28, 2004
Posts: 16695
|
|
Originally posted by james oberon: says lab not abstract and does not override abstract method in line number 4
Compiled and ran fine here ... I am using Java 1.4.2. Henry
|
Books: Java Threads, 3rd Edition, Jini in a Nutshell, and Java Gems (contributor)
|
 |
Jon Egan
Ranch Hand
Joined: Mar 24, 2004
Posts: 83
|
|
James, This means the interface you are implementing ("ActionListener") defines more methods than what you have implemented. Any class that implements an interface has to provide implementations of every method in the interface, or it's not "complete". You could acknowledge to the compiler that you know the class is incomplete, by declaring your class to be "abstract". But then, you still couldn't instantiate one of your Listeners until you created a subclass of that, that defined the remaining methods from the AbstractListener interface. So, the compiler is saying, you had two options to make this thing compile: define your class as abstract, admitting you left it incomplete, orfinish the job and provide implementations for everything left out of AbstractListener By leaving off the "abstract" declaration from your class, you are asserting it is complete. The compiler doesn't agree.... Hope this helps. -- Jon [ January 23, 2006: Message edited by: Jon Egan ]
|
 |
Layne Lund
Ranch Hand
Joined: Dec 06, 2001
Posts: 3061
|
|
Originally posted by james oberon: says lab not abstract and does not override abstract method in line number 4
This still doesn't look like the exact error message. For instance, you don't state what abstract method the compiler says you are supposed to override. If you can, you should copy and paste the whole error message here so you don't lose important details like this. If not, then you should type it WORD FOR WORD. With that said, I don't understand why it would give you this error message. The Lab35B class implements ActionListener and you have overriden the actionPeformed() method correctly from what I can tell. I think this should compile just fine. Of course, as I said before, we are missing some details from your error message that would help us figure out the problem. Please post the FULL error message so we can help you further. Layne
|
 |
 |
|
|
subject: why is this not compiling
|
|
|