Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8950157
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T13:23:20+00:00 2026-06-15T13:23:20+00:00

I have an error in my black jack program. I have been trying for

  • 0

I have an error in my black jack program. I have been trying for half an hour to find out. it says “The type Card is already defined”. and for some reason my deal() function is not working as well. I am posting this again with more information. Can anyone please help? I am a beginner.
So i have an class named index whose main method is:

public static void main(String[] args){
    runGame(2);                                 
}

Then i have a few methods and then i have runGame:

public static void runGame(int n){
    Card[] newdeck=createCardArray();

    Card[] shuffleddeck = shuffle(newdeck); 
    Deck deck = new Deck(shuffleddeck);
    int[] players = createPlayers(n);
    int[] points = createPoints(n);


    for(int i = 0 ; i< players.length - 1; i++){
        Card a = deck.deal();
        Card b = deck.deal();
        updatePoints(players, points, i, a);
        updatePoints(players, points, i, b);
    }
    printPlayersPoints(players, points);
}

In that folder i also have a Card.class and Deck.class: If you want to look i have the links below.
When i run this i get an error i dont know what i did but it changed:

Exception in thread "main" java.lang.Error: Unresolved compilation problems: 
The public type Deck must be defined in its own file
Syntax error on token "}", { expected
Syntax error on token(s), misplaced construct(s)
The public type Card must be defined in its own file
Syntax error on tokens, delete these tokens
The public type Blackjack must be defined in its own file
Syntax error on token "]", invalid (
Syntax error, insert "]" to complete ArrayAccess
Syntax error, insert ")" to complete MethodInvocation
Syntax error, insert ";" to complete Statement
GIO cannot be resolved
GIO cannot be resolved
GIO cannot be resolved
BlackjackWindow cannot be resolved to a type
BlackjackWindow cannot be resolved to a type
GIO cannot be resolved
BlackjackWindow cannot be resolved to a type
Syntax error on token "}", { expected
Syntax error on token(s), misplaced construct(s)
The public type Hand must be defined in its own file
Syntax error on tokens, delete these tokens
The public type Player must be defined in its own file
Syntax error, insert "}" to complete Block
BlackjackWindow cannot be resolved to a type
BlackjackWindow cannot be resolved to a type
GIO cannot be resolved
GIO cannot be resolved
BlackjackWindow cannot be resolved to a type
GIO cannot be resolved
GIO cannot be resolved
GIO cannot be resolved
GIO cannot be resolved
GIO cannot be resolved
Syntax error on token "}", { expected
Syntax error on tokens, delete these tokens
Syntax error, insert "}" to complete Block
Syntax error, insert "}" to complete ClassBody

at Card.<init>(fullblk.java:4)
at index.createCardArray(index.java:19)
at index.runGame(index.java:104)
at index.main(index.java:3)

But for some reason this time i am getting this error:

    Exception in thread "main" java.lang.Error: Unresolved compilation problems: 
    The constructor Deck(Card[]) is undefined
    The method deal() is undefined for the type Deck
    The method deal() is undefined for the type Deck

    at index.runGame(index.java:101)
    at index.main(index.java:3)

Can anyone please help me.

index.java: http://pastebin.com/8x344TN9
Card.java: http://pastebin.com/NLbHBDSi
Deck.java:http://pastebin.com/emD75yv0

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-15T13:23:21+00:00Added an answer on June 15, 2026 at 1:23 pm

    Brace Problem at end of deck class:

    public class Deck
    {
        // your constructors and methods.
      }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Unknown attribute Foreground on element TextBlock I have this error, when I'm trying to
I have found some code online for red black trees, and am trying to
i have to set white background and black foreground into list. generated error is
I have been trying to convert a complex SELECT query to an UPDATE query,
Im trying to find all records that have similar tags to the currently viewed
I am trying to code a game of Blackjack. I have been self-learning C++
I have a webservice that, if appropriate, sends out error messages. I would like
I have been working on a program and when I run it I get
I have project on rails 3 with multiplayer using Faye. The error block in
I have this code to suppress all errors. When an error occurs a blank

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.