In Java language, you cannot put the code in the declaration section. This will cause error at compiler time.
What you need to do is to put your intialization code in your constructor since your constructor will get call when an object is instantiated.
// Here is a example of how you can initialize your deck of card:
public class Deck
{
public Deck()
{
initializeCardDeck();
}
private void initializeCardDeck()
{
// put your initialization code in this method
}
}
|