while (hitOrStay.equalsIgnoreCase("hit"))
{
Card temp[hitOrStayCounter] = cardDeck.deal(); // issue occurs on this line
System.out.println("You are delt a " + temp[hitOrStayCounter].getBJ());
hitOrStayCounter++;
System.out.println("Would you like to hit again?");
hitOrStay = ketboard.next();
}
这是我有问题的代码段。我遇到了一个问题,它说它期待一个']',我试图修复它无济于事。有什么建议么?
public Card deal()
{
nextCard++;
return deck[nextCard-1];
}
public static void main(String[] args)
{
int hitOrStayCounter=5;
Bankroll money = new Bankroll();
Deck cardDeck = new Deck();
Scanner keyboard = new Scanner(System.in);
System.out.println("Would you like to play?");
String playGame = keyboard.next();
while (playGame.equalsIgnoreCase("yes"))
}
这也是具体的错误:
错误:“]”预期