瀏覽單個文章
paradise
Golden Member
 

加入日期: Apr 2001
文章: 2,513
引用:
作者MOSWU
剛剛試了一下上面的程式碼
沒有問題(我也是用eclipse)

能否附上完整的程式碼?


public class Card {

public enum Rank { DEUCE, THREE, FOUR, FIVE, SIX,
SEVEN, EIGHT, NINE, TEN, JACK, QUEEN, KING, ACE }

public enum Suit { CLUBS, DIAMONDS, HEARTS, SPADES }
private Rank rank; // the suit of a card
private Suit suit; // the rank of a card
private int value; // the actual value of a card

/**
* Class constructor
* The default Card constructor, creates a new Card object with default values.
*/
public Card()
{
suit = null;
rank = null;
value = 0;
}

/**
* Class constuctor
* Takes the suit, rank and value the card and create a Card object.
* The suit argument must be in either spade, heart, diamond or club. The
* value of rank argument must be chosen from Ace to K. The value argument must
* be an integer from 1 to 13.
* <p>
* One Card object will be created with the given parameters.
*
* @param suit the suit of the card
* @param rank the rank of the card
* @param value the value of the card
*/
public Card(String suit, String rank, int value)
{
this.suit = suit;
this.rank = rank;
this.value = value;
}

/**
* Get the suit of the card
* @return String
*/
public String getSuit()
{
return this.suit;
}

/**
* Get the rank of the card
* @return String
*/
public String getRank()
{
return this.rank;
}

/**
* Get the actual value of the card
* @return int
*/
public int getValue()
{
return this.value;
}



}

才剛開始 還沒寫出甚麼
更別說是 compile
但是光這樣 eclipse 就出現煩人的 syntax error
請大家再幫忙一下 感謝
舊 2006-09-28, 01:55 AM #6
回應時引用此文章
paradise離線中