的甲板,這是我有如何創建至今卡構造
import java.util.Random;
public class DeckOfCards
{
public static final int DECK_SIZE = 52;
//Instance Variables
private boolean[] deck; //An implicit set of 52 Playing-Cards
private int cardsInDeck;//Number of cards currently in the deck
private Random dealer; //Used to rendomly select a card to be dealt
//Constructor
public DeckOfCards()
{
deck = new boolean[52];
for (int j = 0; j<deck.length ; j ++)
deck [j] = false;
我現在去往正確的方向?......我在這之後做什麼?我對布爾型數組不熟悉
還有一個類似的問題在這裏:http://stackoverflow.com/questions/5629130/how-do-i-write-a-constructor-that-initializes-52-card-objects – Leon
布爾數組持有'每個元素上的'false'作爲布爾值的缺省值。 –