Win a copy of Escape Velocity: Better Metrics for Agile Teams this week in the Agile and Other Processes forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Tim Cooke
  • Paul Clapham
  • Jeanne Boyarsky
Sheriffs:
  • Ron McLeod
  • Frank Carver
  • Junilu Lacar
Saloon Keepers:
  • Stephan van Hulst
  • Tim Moores
  • Tim Holloway
  • Al Hobbs
  • Carey Brown
Bartenders:
  • Piet Souris
  • Frits Walraven
  • fred rosenberger

Action interface

 
Greenhorn
Posts: 20
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hey everybody.


I know that the code is probably too long, but pleas help. This is an example from Core Java. There are 12 errors whic can all be in a couple
of categries. The first is the Action interface problem. If i try to make a listener or yellowAction for example, then i get an error that there is
an incompatibile type. But the AbstractAction implements Action interface and it should work. On the other hand, if I make an object of ColorAction
or AbstractAction, but not Action, then the static fields in the Action interface cant be accessed with a "cannot find symbol" error message.
This is straight from the book but it doesnt work.

Also, i tried to run some small code fragments with some class extending AbstractAction and i got the same error. I checked the API and
the AbstractAction implements Action so it should work. What am I thinking wrong?
 
Bartender
Posts: 825
5
Python Ruby Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
No errors here, works perfectly with me.
 
Bartender
Posts: 4179
22
IntelliJ IDE Python Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

If i try to make a listener or yellowAction for example, then i get an error that there is
an incompatibile type. But the AbstractAction implements Action interface and it should work.



Most likely you have another class you named Action in your classpath. Find it, rename (and recompile) it, and/or remove it. Then recompile the code above.
 
Mario Skrlec
Greenhorn
Posts: 20
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I had another class named ActionTest. I am sorry for wasting your time!!!
 
Steve Luke
Bartender
Posts: 4179
22
IntelliJ IDE Python Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Mario Skrlec wrote:I had another class named ActionTest. I am sorry for wasting your time!!!



Bah:

No question is too simple or too small!

This isn't a waste of time. It is a common mistake and something that happens at least once before you learn to check for it.

I am glad you found the fix.
 
Get off me! Here, read this tiny ad:
the value of filler advertising in 2021
https://coderanch.com/t/730886/filler-advertising
reply
    Bookmark Topic Watch Topic
  • New Topic