I keep getting a .class expected error in the if statement. help please.

private int[] hand;
    private int[] play;
public PokerHand(){
          this.hand = new int[5];  
        }
public boolean haveCard(int card){
    if (play[] == card)
        return true;
}
public void displayCards(){
    System.out.println(hand);
}
public void dealCards(){

Please post the full text of the error message.

An array element reference requires an index.

if (play[] == card)

This line is invalid Java syntax. If you want to check if an int array contains a particular int value, you'll either have to loop over the array to check the occurrence of that value or convert the array to something like a Set (if ordering is not important) and then use its contains method.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.