我正在尝试制作一个 Card 类来代表扑克牌。底部的代码运行顶部的代码。我只需要帮助开始。我不完全确定如何。我如何也为这个类创建构造函数?
public class Card
{
public static final String FACES[] = {"ZERO","ACE","TWO","THREE","FOUR",
"FIVE","SIX","SEVEN","EIGHT","NINE","TEN","JACK","QUEEN","KING"};
//instance variables
//String suit
//int face
//constructors
// modifiers
//set methods
//accessors
//get methods
//toString
}
public class CardRunner
{
public static void main( String args[] )
{
Card one = new Card("SPADES", 9);
out.println(one.getSuit());
out.println(one.getFace());
Card two = new Card("DIAMONDS", 1);
out.println(two);
two.setFace(3);
out.println(two);
Card three = new Card("CLUBS", 4);
out.println(three);
Card four = new Card("SPADES", 12);
out.println(four);
Card five = new Card("HEARTS", 12);
out.println(five);
}
}