Consider this class for Question:
public class BingoCard
{
private int[] card;
/** Default constructor: Creates BingoCard with
* 20 random digits in the range 1 - 90.
*/
public BingoCard()
{ /* implementation not shown */ }
/* Display BingoCard. */
public void display()
{ /* implementation not shown */ }
...
}
A program that simulates a bingo game declares an array of BingoCard. The array has NUMPLAYERS elements, where each element represents the card of a different player.
Here is a code segment that creates all the bingo cards in the game:
/* declare array of BingoCard */
/* construct each BingoCard */
Assuming that players has been declared as an array of BingoCard, which of the following is a correct replacement for
/* construct each BingoCard */
I
for (BingoCard card : players)
card = new BingoCard();
II
for (BingoCard card : players)
players[card] = new BingoCard();
III
for (int i = 0; i < players.length; i++)
players[i] = new BingoCard();
(A) I only
(B) II only
(C) III only
(D) I and III only
(E) I, II, and III