-1
當我寫System.out.print(dice)
輸出隨機生成的數字是這樣的:如何使用數組來創建多個輸出?
[3|4|7|6|6]
如何我可以使用陣列有多個值嗎?
/**
* This program rolls Yahtzee! dice 1,000,000 times, recording the number of
* Yahtzees which occur. After the trials statistics are produced.
*/
/**
* @param args the command line arguments
*/
public static void main(String[] args) {
// TODO code your application logic here
Scanner input = new Scanner(System.in);
Random generator = new Random();
YahtzeeDice dice = new YahtzeeDice(generator);
System.out.print(dice);
}
}
在這裏檢查或多或少相同的問題。 http://stackoverflow.com/questions/1067073/initialising-a-multidimensional-array-in-java – 2015-03-24 23:57:24