public class Card
{
private final int value;
public Card( int value )
{
if( value < 2 || value > 11 )
throw new IllegalArgumentException( "Not a valid card value " + value );
this.value = value;
}
public int getValue()
{
return value;
}
}
public class Deck
{
private static final int[] NUMBER_IN_DECK = new int[] {0, 0, 4, 4, 4, 4, 4, 4, 4,
4, 16, 4};
…
public void add( Card card ) throws IllegalStateException
{
文章来源于领测软件测试网 https://www.ltesting.net/