Class for representing a card in Java?

后端 未结 6 787
无人及你
无人及你 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:34

    Java as of 1.5 fully supports enums. Coincidentally, the example provided in the link uses a card class as an example much as you are trying to do.

    The base class you have there is sufficient with the addition of getters. Implementing Comparable could prove valuable should you need to do sorting at some point.

提交回复
热议问题