Re: Java compilation error message.



If you have a class which is implemented from an Interface. You have to
add all the implemented methods.


ri.johnson@xxxxxxxx wrote:
> Attempting to write my first java program that accepts user input.
> When I add the listner events to the code it will not compile. Below
> is the code along with the error message:
>
>
> Code:
>
> import javax.swing.*;
> import java.awt.event.*;
>
> public class LottoEvent implements ItemListener, ActionListener,
> Runnable {
>
> }
>
> Compilation Error message:
>
> javac LottoEvent.Java: LottoEvent is not abstract and does not override
> abstract method itemStateChanged(java.awt.event.ItemEvent) in
> java.awt.event.ItemListener public class LottoEvent implements
> ItemListener, ActionListener, Runnable
>
> ^
>
> 1 error
> Any ideas on how to fix it would be appreciated.

.



Relevant Pages

  • Re: Java compilation error message.
    ... >abstract method itemStateChangedin ... >java.awt.event.ItemListener public class LottoEvent implements ... This message sounds misleading. ... provide a suitable itemStateChanged method to implement ItemListener. ...
    (comp.lang.java.help)
  • Re: Java compilation error message.
    ... abstract method itemStateChangedin java.awt.event.ItemListener public class LottoEvent implements ... public class LottoEvent implements ItemListener, ActionListener, Runnable { ... Interfaces enforce certain methods, so when you implement the interface you have to implement the methods of the interface. ...
    (comp.lang.java.help)
  • Java compilation error message.
    ... When I add the listner events to the code it will not compile. ... public class LottoEvent implements ItemListener, ActionListener, ... abstract method itemStateChangedin ...
    (comp.lang.java.help)