Programming project. blackjack, String array issue

Join the discussion
Registration is free. Ask a follow-up in this thread, or start your own.
2 replies · 2K views
opaquin
Messages
10
Reaction score
0
Not sure what's going one, as soon as I remove the line with String[] arraySuit... all errors go away. With that statement in I get errors on several lines. Cannot figure out what's wrong.

Code:
/*
 * Semester Project
 * Blackjack Class
 */
package project;
import java.util.*;

/**
 * Oliver Paquin
 * CIS132
 * December 10, 2012
 */

class Blackjack 
{
    //declare and set arrays for suits and cards
    String[] arraySuit = {"Hearts", "Diamonds", "Spades" "Clubs"};
    int[] arrayCards = {1,2,3,4,5,6,7,8,9,10,11,12,13};
    
    
    int number1, number2;
    
    public int dealCards()
    {
        //Create Random class object
        Random randomNumbers = new Random();
        
        number1 = randomNumbers.nextInt(3);
        number2 = randomNumbers.nextInt(12);  
        
                 
        //Display random numbers for testing
        
        System.out.println(arrayCards[number2]);
        
        return number1;
        
    }
    
}
 
Physics news on Phys.org
Could it be because you're missing a comma between "Spades" and "Clubs"?

(Since "Spades" and "Clubs" are separate strings in the array, they need to be separated by a comma.)
 
Thanks...tomorrow I'm going to get my eyes checked.