Package  

 Class 

Tree 

Deprecated 

Index 

Help 

 

 PREV CLASS   NEXT CLASS

FRAMES    NO FRAMES    

 

SUMMARY: NESTED | FIELD | CONSTR | METHOD

DETAIL: FIELD | CONSTR | METHOD

 

size=2 width="100%" align=center>

Class Card

java.lang.Object
  extended byCard

public class Card

extends java.lang.Object

An encapsulation of a card in a deck of "playing cards". A card has a suit ("Clubs", "Diamonds", "Hearts" or "Spades") and a value ("2", "3", ..., "10", "Jack", "Queen", "King", or "Ace")


Field Summary

static int

ACE
           

static int

CLUBS
           

static int

DIAMONDS
           

static int

HEARTS
           

static int

JACK
           

static int

KING
           

static int

QUEEN
           

static int

SPADES
           

 

Constructor Summary

Card(int suit, int value)
          Explicit Value Constructor

 

 

Method Summary

 java.lang.String

getSuit()
          Get a String representation of the suit of this Card

 java.lang.String

getValue()
          Get a String representation of the value of this Card

 java.lang.String

toString()
          Return a formatted String representation of this Card (that contains the suit and value)

 

Methods inherited from class java.lang.Object

clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait

 

Field Detail

CLUBS

public static final int CLUBS

See Also:

Constant Field Values


DIAMONDS

public static final int DIAMONDS

See Also:

Constant Field Values


HEARTS

public static final int HEARTS

See Also:

Constant Field Values


SPADES

public static final int SPADES

See Also:

Constant Field Values


JACK

public static final int JACK

See Also:

Constant Field Values


QUEEN

public static final int QUEEN

See Also:

Constant Field Values


KING

public static final int KING

See Also:

Constant Field Values


ACE

public static final int ACE

See Also:

Constant Field Values

Constructor Detail

Card

public Card(int suit,
            int value)

Explicit Value Constructor

Parameters:

suit - The suit (CLUBS, DIAMONDS, HEARTS, SPADES)

value - The value (2, 3, ... 10, JACK, QUEEN, KING, ACE)

Method Detail

getSuit

public java.lang.String getSuit()

Get a String representation of the suit of this Card

Returns:

"Clubs", "Diamonds", "Hearts" or "Spades"


getValue

public java.lang.String getValue()

Get a String representation of the value of this Card

Returns:

"2", "3", ..., "10", "Jack", "Queen", "King", or "Ace"


toString

public java.lang.String toString()

Return a formatted String representation of this Card (that contains the suit and value)

Returns:

The String representation of this Card

size=2 width="100%" align=center>

 

Package  

 Class 

Tree 

Deprecated 

Index 

Help 

 

 PREV CLASS   NEXT CLASS

FRAMES    NO FRAMES    

 

SUMMARY: NESTED | FIELD | CONSTR | METHOD

DETAIL: FIELD | CONSTR | METHOD

 

size=2 width="100%" align=center>