File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
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: 45276
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
It's not a secret anymore!