Meaningless Drivel is fun!
The moose likes Beginning Java and the fly likes Enums and diffrent classes Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Enums and diffrent classes" Watch "Enums and diffrent classes" New topic

Enums and diffrent classes

Chadd Franck
Ranch Hand

Joined: Nov 05, 2008
Posts: 50
Is this a legal declaraition?

PlayerOne is an Object that extends LifeformTemplate
and has a public method called getStat(StatsEnum m)
that returns an Integer and a public enum in the LifeformTemplate class called StatsEnum {STR, CON};

Campbell Ritchie

Joined: Oct 13, 2005
Posts: 46352
Just at a � second look, it looks all right. You are passing a String to a JTextField constructor, which should be OK. You will have to try it to confirm that it shows what you actually want . . .
Chadd Franck
Ranch Hand

Joined: Nov 05, 2008
Posts: 50
Yes it did end up being valid, I had some problem elsewhere in my code, I figured it out but don't remember what it was. It was my first time time using enums and I wasn't sure you could access them from another class' method.
I agree. Here's the link:
subject: Enums and diffrent classes
jQuery in Action, 3rd edition