How can I make cards Enum in Java similar to:
public enum Card {2, 3, 4, 5, 6, 7, 8, 9, 10, Jack, Queen, King, Ace};
I tried {“2”, “3”…}. It’s not working either
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
The JLS (Java Language Specification) tells us two important facts:
Java enum fields must be valid identifiers.
The first character of an identifier must be a “Java letter.”
You must work within these restrictions.