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 6855199
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T01:43:39+00:00 2026-05-27T01:43:39+00:00

I am writing a java program to make a simple blackjack game. I am

  • 0

I am writing a java program to make a simple blackjack game.

I am using an array of card objects as the users hand.

the user will be dealt two cards in their hand, however they can ask for another card until they reach a limit of 5 cards.

For this reason I have made the array of card objects with 5 slots to allow for the possibility of further cards being added to the hand.

However now I can’t print the original hand when dealt or if the user does not ask for the full 5 cards because my array will have null objects.

What is the quickest, simplest and easiest way to fix this issue?

  • 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-05-27T01:43:39+00:00Added an answer on May 27, 2026 at 1:43 am

    Check for null before you do anything:

    if(x[i] == null){
        don't.do.anything();
    }else {
        print.something();
    }
    

    The methods are fake obviously but try something like that.

    But as the comment above says, you would be better off with a list.

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

Sidebar

Related Questions

I tried writing a program in Java using regex to match a pattern and
In a Java program i am writing i make a jni call to a
I am writing a java program which will create a database LocalStations where it
I'm writing a program using the Winsock API because a friend wanted a simple
I am writing a java program that needs a file open dialog. The file
I am writing this java program to find all the prime numbers up to
I'm making a mini ORM for a Java program I'm writing... there is a
I'm writing a program in Java where I read in data from an XML
I am writing somewhat of a proxy program in Java. Here's how it works:
I am writing a program that needs to run a java.jar server. I need

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.