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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T13:22:30+00:00 2026-06-06T13:22:30+00:00

I have started programming a few weeks ago in java/android. I want to write

  • 0

I have started programming a few weeks ago in java/android. I want to write a small tic tac toe game as an android app but I’m having trouble with my method that will check for the winner. It is as follows:

 public void checkForWinner() { 

        if( taken[0] && taken[3] && taken[6]  ||
            taken[0] && taken[1] && taken[2] ||
            taken[2] && taken[5] && taken[8] ||
            taken[6] && taken[7] && taken[8] ||
            taken[0] && taken[4] && taken[8] ||
            taken[2] && taken[4] && taken[6] ||
            taken[1] && taken[4] && taken[7] ||
            taken[3] && taken[4] && taken[5] == 1 ){}
}

Here I have an array called taken that holds 9 integers, each of those integers being either a one, meaning player one owns that block, or a two, meaning player two ows that block. Current, I am trying trying all possible scenarios in which player one would be the winner but eclipse is telling me that The operator && is undefined for the argument type(s) int, int. The error only seems to be showing for the first logical and operation of each line of the if statement. For example the first error goes up to taken[0] && taken[3] and then disappears until the next line.

  • 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-06T13:22:31+00:00Added an answer on June 6, 2026 at 1:22 pm

    Alternatively, you can check taken[n] values to see if they hold 1 or 2, if you think that’d make your code clearer:

    (taken[0]==1 && taken[3]==1 && taken[6]==1)
    

    Keep in mind that the && operator expects boolean operands…so it won’t work with your int array the way you’re expecting it to.

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

Sidebar

Related Questions

I'm pretty new with Android programming, started a few weeks ago. Stackoverflow it's my
I have just started programming and have made a few small applications in C
I have started programming few years ago. and generally i use for programming C
I started programming in Lua few days ago. I have become familiar with the
Am new to android programming, just started learning it the past 6 weeks and
I started programming in c# for a few days ago, so I am a
I have recently started programming in WPF and bumped into the following problem. I
I have recently started programming in PHP. I am building a cart in PHP.
I started programming in Python on Monday. I have enjoyed learning it. But I
Since I started programming, I have read in every place to avoid wasteful branches

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.