我正在尝试编写一个程序来处理我随机生成的一手牌。出于某种原因,我无法让它从我在主程序中的方法中打印字符串。我不确定我是否遗漏了某些东西,或者这一切都是错的,我对 Java 场景还是很陌生。这就是我得到的。
public class Deck {
public static void main (String args[]) {
Builder();
out.println("Your hand is:" card )
}
// This will build the deck
public static String Builder() {
// I need this to pick from the random array
Random r = new Random();
// This is an array, to make one you need [] before string
//This is how you get your ending
String[] SuitsA = { "Hearts ", "Diamonds ", "Spades ", "Clubs" };
// The number array
String[] FaceA = {"1","2","3","4","5","6","7","8","9","10","King ", "Queen ", "Jack ", "Ace ",};
// Picks a random set from the arrays
String suit = SuitsA[r.nextInt(4)];
String face = FaceA[r.nextInt(14)];
//Tryng to make 1 string to return
String card = ( suit + " of " + face );
// This might give me a value to use in the method below
out.println( card );
return;
}
}