Skip to main content

Question regarding playing cards example.

1 reply [Last post]
Joined: 2008-08-16

In the following code:

contained the following sigment:
public Deck() { // Why is this line required?

Why is the Deck() part required? This would be considered the default constructor right? Without it shouldnt the code still be ok? I can see in eclipse that it warns me that the cards = new Card[numSuits][numRanks]; line now requires extra syntax.

What am I missing here? Thanks.

Message was edited by: ceromus

Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
Joined: 2008-08-16

I got my answer:

You can't have code in the "class scope", only declarations.

I must have missed that part in the tutorial?