Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我必须创建一个方法,该方法接受一个整数参数并返回一个数组,其中包含对通过调用创建的甲板对象的许多引用generateCard()。
generateCard()
这是我写的:
int [] generateDeckOfNCards(int n) { int [] generateDeckOfNCards = new int[n]; return generateDeckOfNCards; }
您应该声明一个对象数组DeckCard(不是ints),并填充它。
DeckCard
int
包括以下内容:
DeckCard[] generateDeckOfNCards(int n) { DeckCard[] res = new DeckCard[n]; for (int i = 0; i < n; i++) { res[i] = generateCard(); //assuming such a method exists. } return res; }