Array of a class?
Hello everyone,
I want to make an array of a class, in this case, 'card' class. I was able to create it using the following code:
private card [] deck = new card[52];
However, I cannot change variables in the class.
When I use the following code:
deck[a].setValue(a);
or deck[a].value = 0;
I dont get any compiler errors, but when the applet opens, it is a blank white screen and says: Start: applet not initialized. That code is in init(){}
Thanks!!
[508 byte] By [
cmpolisa] at [2007-11-27 10:41:40]

> Hello everyone,
> I want to make an array of a class, in this case,
> 'card' class. I was able to create it using the
> following code:
> rivate card [] deck = new card[52];
Now of course you have initialized each card item in the deck before using it first, right? What I mean is that you did something analogous to this:
public void initDeck()
{
Card[] deck = new Card[52];
for (int i = 0; i < deck.length; i++)
{
deck[i] = new Card();
}
}
correct?