Java enum in card class to output in main and build deck in deck class
<p>Hey guys I'm new to this site but have been looking at a lot of info on enums and I am kinda figuring them out but could use some help. What I'm trying to do is get the card constructor in my card class to take in int values and return the rank and suit associated with those values. This is what I'm working with in my Card class. </p>

<pre><code>
package blackjack;

public class Card {
    static Rank rank;
    static Suit suit;

    public enum Rank{ACE(1),TWO(2),THREE(3),FOUR(4),FIVE(5),SIX(6),SEVEN(7),
        EIGHT(8),NINE(9),TEN(10),JACK(11),QUEEN(12),KING(13);

        private int code;

        public int getCode() {
            return code;
        }

        private Rank(int code) {
            this.code = code;
        }

        public static Rank valueOf(int code) {
            for (Rank rank: Rank.values()) { 
                if (rank.getCode()==code) 
                    return rank;
             }
            throw new RuntimeException("INVALID CODE");
        }

        @Override public String toString() {
            String s = super.toString();
            return s.substring(0, 1) + s.substring(1).toLowerCase();
        }
    }


    public enum Suit{SPADES(1),HEARTS(2),CLUBS(3),DIAMONDS(4);

        private int code;



        public int getCode() {
            return code;
        }


        private Suit(int code) {
            this.code = code;
        } 

        public static Suit valueOf(int code) {
            for (Suit suit: Suit.values()) { 
                if (suit.getCode()==code) 
                    return suit;
             }
            throw new RuntimeException("INVALID CODE");
        }
        @Override public String toString() {
            String s = super.toString();
            return s.substring(0, 1) + s.substring(1).toLowerCase();
        }
    }

    public Card(int rank,int suit) {
        this.suit = Suit.valueOf(suit);
        this.rank = Rank.valueOf(rank);
    }

    public static void setRank(Rank rank) {
        Card.rank = rank;
    }

    public static Rank getRank() {
        return rank;
    }

    public static void setSuit(Suit suit) {
        Card.suit = suit;
    }

    public static Suit getSuit() {
        return suit;
    }
}
</code></pre>

<p>Here in my main class which is called BlackJack all I really wanna do is create a new card and assign it the rank and suit using ints from the constructor I created in Card and then output it just to make sure its working. I keep getting this crazy error that I cant figure out. Any help would be apprecated! This is my BlackJack/main class.</p>

<pre><code>
package blackjack;

public class BlackJack {    

    public static void main(String[] args) {

        Card c1 = new Card(1,1);
        System.out.println(c1.rank.toString());
    }
}
</code></pre>
