Getting the "cannot find Symbol" error when referencing a method from another class

161 views Asked by At

I am writing a WAR game and have 3 files. The Card class has the definition for a card and the methods to manipulate a card. The FullDeck class the methods to create a card and a deck of cards. The code is shown here.

public class FullDeck
{

public Card CreateCard(int s, int c)
{
  Card aCard = new Card();
  aCard.SetSuit(s);
  aCard.SetCardVal(c);
  return aCard;
}  

public void CreateDeck(Card [] cDeck)
{
  int sval;                  // Suit value
  int cval;                  // Card value
  int ctr = 0;               // Counter
  final int highValue = 13;  // Highest card value
  final int numSuits = 4;    // Number of suits
  int theSuitNum;

  for (sval = 1; sval <= numSuits; ++sval)
  {
     for (cval = 1; cval <= highValue; ++cval)
     {
        cDeck[ctr] = CreateCard(sval, cval);
        theSuitNum = cDeck[ctr].GetSuit();
        cDeck[ctr].PrintCard();
        ctr = ctr+ 1;
     }
  }
}
}

The third file contains the WAR class and it calls the CreateDeck method with the stmt

CreateDeck(theCards); where theCards equals new Card[numCards]

When I compile, I receive the following message:

----jGRASP exec: javac -g War3.java

War3.java:173: error: cannot find symbol CreateDeck(theCards); ^ symbol: method CreateDeck(Card[]) location: class War3 1 error

----jGRASP wedge2: exit code for process is 1.

I am not understanding why I cannot find the CreateDeck method from the FullDeck class.

I would appreciate any help that you can give me.

0

There are 0 answers