编辑:
主要方法...
创建一个新玩家。
玩家等级...
创建一个手的实例。
手课...
创建一个数组列表
就这样。它很简单
public class Player
{
/*------------------------
* instantiating variable
-----------------------*/
protected Hand hand;
protected boolean active = false;
/*------------
* constructor
-----------*/
public Player()
{
hand = new Hand();
hand.setSize(5);
}
public class Hand extends Player
{
/*-----------------------------------------
* variable declaration
----------------------------------------*/
ArrayList <Card> hand;
protected int size;
Card temp;
/*------------------------------------------
* constructor
* creates arraylist of cards to keep in hand
------------------------------------------*/
public Hand()
{
hand = new ArrayList<Card>();
}
/*-------------------------------
* sets the size of the max hand
------------------------------*/
public void setSize(int newSize)
{
size = newSize;
}
编辑:错误是:
线程“主”java.lang.StackOverflowError 中的异常
at Player.<init>(Player.java:19)
at Hand.<init>(Hand.java:21)
Player 中的第 19 行是“public Player()”
Hand 的第 21 行是“public Hand()”
仅供参考