Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import javax.smartcardio.Card;
- public class Game {
- private int rank;
- private int suit;
- public Card(int rank, int suit) {
- this.rank = rank;
- this.suit = suit;
- }
- public String toString() {
- String[] ranks = {null, "Ace", "2", "3", "4", "5", "6",
- "7", "8", "9", "10", "Jack", "Queen", "King"};
- String[] suits = {"Clubs", "Diamonds", "Hearts", "Spades"};
- String s = ranks[this.rank] + " of " + suits[this.suit];
- return s;
- }
- public static void main(String[] args) {
- Card card = new Card(11,1);
- System.out.println(card);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement