Class for representing a card in Java?

后端 未结 6 845
无人及你
无人及你 2021-01-15 22:04

I\'m making a blackjack program in Java, and I was starting to write the class declaration for an object Card. Will this be sufficient, or are there some methods I should ha

6条回答
  •  轮回少年
    2021-01-15 22:30

    With respect to "are there some methods I should have that I'm glossing over", that's really subjective and based the context in which the class is used. For example, if you never need to print the object, you may not need a 'toString()' function, but if you do, it might come in handy (especially if you want output formatted in a specific manner).

    Java also has enum's, see here for a tutorial.

提交回复
热议问题