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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T04:54:03+00:00 2026-06-17T04:54:03+00:00

Array before. String[] player = {Empty,Empty,Empty,Empty} Array after input. String[] player = {Tom,Bob,Alex,Kid} I

  • 0

Array before.

  String[] player = {"Empty","Empty","Empty","Empty"}

Array after input.

String[] player = {"Tom","Bob","Alex","Kid"}

I remember there was a way to check all of the elements of the array.

if(!player[0].equals("Empty") && !player[1].equals("Empty") && !player[2].equals("Empty") && !player[3].equals("Empty"))
{
   System.out.println("No more space");
}

My question. Is there a way to select all of the elements of an array?

  • 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-17T04:54:04+00:00Added an answer on June 17, 2026 at 4:54 am

    You can iterate over the array implicitly:

    if(!Arrays.asList(player).contains("Empty"))
       System.out.println("No more space.");
    

    or iterate over the array explicitly:

    for(String p : player)
    {
        if(!p.equals("Empty"))
           continue;
        else
        {
           System.out.println("No more space.");
           break;
        }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

How can i check if a string is already present withing an array before
I am trying to check if the annotation exists before adding it to array.
i was wondering is there's only one way ( regex ) to split string
I am trying to sanatize the input using mysql-real-escape-string before i save the data
I want to add an additional value into an array before passing it to
As I know, an array needs to have a specific size before compiling time
array(2) { [0]=> array(4) { [id]=> string(1) 1 [name]=> string(3) Lim [subproject_id]=> string(1) 5
How to extract and save array from string parameter? I'm trying convert string beafore_create
I have an empty array collecting a hex value thats randomly selected from another
I think the problem is pretty common. You have some input string, and have

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.