Using enums in Java across multiple classes
- by Richard Mar.
I have the following class:
public class Card
{
public enum Suit
{
SPACES, HEARTS, DIAMONDS, CLUBS
};
public Card(Suit nsuit, int nrank)
{
suit = nsuit;
rank = nrank;
}
private Suit suit;
private int rank;
}
I want to instantiate it in another class, but that class doesn't understand the Suit enum. Where should I put the enum to make it publicly visible?