編集:
主な方法...
新しいプレーヤーを作成します。
プレイヤークラス...
手のインスタンスを作成します。
ハンドクラス...
配列リストを作成します
それで全部です。その非常にシンプル
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行目は「publicPlayer()」です
Handの21行目は「publicHand()」です。
参考までに