Java 编译时,我不断收到此错误消息';。类别';此行应为this.hand=卡片[]手;我不知道';我不知道该怎么做才能改变它

Java 编译时,我不断收到此错误消息';。类别';此行应为this.hand=卡片[]手;我不知道';我不知道该怎么做才能改变它,java,Java,我在网站上寻找帮助,但我仍然找不到这个问题的答案 代码如下: import java.util.Scanner; public class Player { private Card[] hand; private int placement; private Strategy myStrategy; public Player( Card hand, Strategy myStrategy ) { this.hand = Card[] hand; this.myStrat

我在网站上寻找帮助,但我仍然找不到这个问题的答案

代码如下:

import java.util.Scanner;

public class Player {

private Card[] hand;
private int placement;
private Strategy myStrategy;

public Player( Card hand, Strategy myStrategy ) {
    this.hand = Card[] hand;
    this.myStrategy = myStrategy;
    placement = 0;
}

public void giveCard( Card newCard ) {
    hand[placement] = new Card();
    placement++;
}

public int takeTurn() {
    return myStrategy.hitOrStand();
}

public int value() {
    int value = 0;

    for( int i = 0; i < placement; i++ ) {
        this.value = value + hand[i].value();
    }

    return value;
}
}
import java.util.Scanner;
公开课选手{
私人卡[]手;
私募;
私人战略;
公众玩家(牌手、策略){
this.hand=卡片[]手;
this.myStrategy=myStrategy;
位置=0;
}
公共卡(新卡){
手动[放置]=新卡();
布局++;
}
公共int takeTurn(){
返回myStrategy.hitOrStand();
}
公共int值(){
int值=0;
对于(int i=0;i
我对如何改变这一点感到困惑。有人能帮我确认一下我做对了吗

this.hand = Card[] hand;
这是违法的。你可以试试

this.hand = new Card[] { hand };

注意此时手牌阵列中只有一张牌的空间。我建议您使用收藏类型(我可能自己也会使用集合或列表)。

我已经尝试过进行更改,但仍然是这样。