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

  • SEARCH
  • Home
  • 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 8925311
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T07:39:38+00:00 2026-06-15T07:39:38+00:00

Anyone???? Hi, in my black jack game i implemented splits by first asking the

  • 0

Anyone???? Hi, in my black jack game i implemented splits by first asking the player to double down and if he rejects then i allow him to split:

while(true){
    for(int j=0;j<2;j++){
        if(players[i].splits[j].getStatus() != true){ // splits is an array of two players hand 1 and hand 2
            System.out.print("Choose your next move, " + players[i].name + ", Hand "+ players[i].splits[j].number + ": \n" + "Points: " + players[i].splits[j].points + "\n" + "Hint: ");
            getHints(players[i].splits[j]);
            System.out.print( "\n1)Hit\n2)Stand\n");
            System.out.println();

            x2 = IO.readInt();
            if (x2==2){
                players[i].splits[j].standed = true; // if player stand...
                break;
            }else if(x2 == 1){//else deal a card
                Card c = dealCard(deck);
                updatePoints(players[i].splits[j], c);
                addCard(players[i].splits[j], c);
                System.out.println(players[i].name + ", Hand "+ players[i].splits[j].number + " was dealt:  " + c.showCardValue() + " of " + c.showCardSuit() );
                boolean isBusted = testPoints(players[i].splits, j); // test for busted
                if (isBusted == true){
                    System.out.println("BUSTED!!!!!!!!!");
                    players[i].splits[j].busted = true;
                    break;
                }
            }
        }
        System.out.println(players[i].name + ", Hand " + players[i].splits[j].number + " Points: "+ players[i].splits[j].points);
//                                          printStats(players[i].splits[j]);

    }
//check to end loop if split is busted to stands...
}

when i print the players stats i get the memory location instead of the text, can any one please help. Thank you, if you need more information please say so so i can update it.

=======

Output: 3 is the player name… 10 was the card dealt which was a split…

Choose your next move, 3, Hand 1: 
Points: 10
Hint: You have a 0% chance of busting
1)Hit
2)Stand

1
3, Hand 1 was dealt:  Ten of Spades
3, Hand 1 Points: 20
Choose your next move, 3, Hand 2: 
Points: 10
Hint: You have a 0% chance of busting
1)Hit
2)Stand

1
3, Hand 2 was dealt:  Five of Diamonds
3, Hand 2 Points: 15
Choose your next move, 3, Hand 1: 
Points: 20
Hint: You have a 92% chance of busting
1)Hit
2)Stand

2
3, Hand 1 Points: 20
Choose your next move, 3, Hand 2: 
Points: 15
Hint: You have a 58% chance of busting
1)Hit
2)Stand

2
3, Hand 1 : Points splitPlayer@1a758cb
Previous Cards dealt: 
Ten of Spades 

Five of Diamonds 

splitPlayer class:

public class splitPlayer {

    public int points = 0;
    boolean busted = false;
    boolean standed = false;
    int number = 0;
    int ace = 0;
    String name = "";
    Card[] cardsDealt = new Card[12];


    public splitPlayer(int number, int points){
        this.number = number;
        this.name = "Hand "+ number;
        this.points = points;
    }
    public boolean getStatus(){
        if(busted == true || standed == true ){
            return true;
        }else{
            return false;
        }
    }
    public void setPoints(int points){
        this.points += points;
    }
}

=========

updatePoints:

public static void updatePoints(splitPlayer player,  Card c){

        int point = c.getValue();

        if (point == 1){


            player.ace += 1;
            player.setPoints(11);


        }else{
            player.setPoints(point);
        }

        if (player.points > 21 && player.ace > 0) {
            player.points -= 10;
            player.ace --;
        }





        return;
    }
  • 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-15T07:39:41+00:00Added an answer on June 15, 2026 at 7:39 am

    The culprit appears to be this line of code:

    System.out.println(players[i].name + ", Hand " + players[i].splits[j].number + " Points: "+ players[i].splits[j].points);
    

    To figure out what is wrong, you need to know what the type of players[i].splits[j].points is. According to the output, it appears to be an instance of the splitPlayer class. You might be able to solve the problem by overloading the toString() method of this class. I can’t know for sure without confirmation that the above line of code is really causing the problem. I also need to see more of your code, in particular the declaration of the points data member which is used here.

    Addendum:

    The reason that you see splitPlayer@1a758cb in the output is because you are concatenating an object with a String. Java will automatically call the toString() method of the object. If the object’s class does not provide a toString() method, the one in Object will be called which gives the output you see.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Can anyone correct the expression below to also not allow blank field? <asp:RegularExpressionValidator ID=expEmail
Does anyone program with white text against black background? I have heard some rumors
Can anyone tell me why the black borders are appearing in the emulator, and
So on my final project, a black jack and poker simulator using inheritance from
Can anyone tell me why the background color 'black' isn't being picked up on
Does anyone know what the HIG are saying about the black HUD UI in
I have an error in my black jack program. I have been trying for
Has anyone tried to back up a SharePoint web application using forms based authentication
Can anyone tell me what is holding us back. I tried every different php
Can anyone please suggest a way to replace back-slash '\' with slash '/' in

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.