aspose file tools*
The moose likes Beginning Java and the fly likes Action interface Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Action interface" Watch "Action interface" New topic
Author

Action interface

Mario Skrlec
Greenhorn

Joined: Apr 15, 2012
Posts: 20
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?
Kemal Sokolovic
Bartender

Joined: Jun 19, 2010
Posts: 825
    
    5

No errors here, works perfectly with me.


The quieter you are, the more you are able to hear.
Steve Luke
Bartender

Joined: Jan 28, 2003
Posts: 4181
    
  21

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.


Steve
Mario Skrlec
Greenhorn

Joined: Apr 15, 2012
Posts: 20
I had another class named ActionTest. I am sorry for wasting your time!!!
Steve Luke
Bartender

Joined: Jan 28, 2003
Posts: 4181
    
  21

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.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Action interface