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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T02:44:20+00:00 2026-06-09T02:44:20+00:00

I read some articles from Stackoverflow.com, especially: What's the most concise way to get

  • 0

I read some articles from Stackoverflow.com, especially:

What's the most concise way to get the inverse of a Java boolean value?

Easiest way to flip a boolean value?

What’s happens if I have three boolean variables ? I want to assign a true/false value using single line.

For example, test1 and test3 must be true and test2 must be false.

I used

test1 = test2 ^= test3 = true;   //true, false, true

or

test1 = test3 ^= test2 ^= true;

But it not good. The logic is not good.

I know that my question is simple but I have 6-7 boolean variables and I want to assign values using single line, if is possible.

It is possible ?

  • 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-09T02:44:23+00:00Added an answer on June 9, 2026 at 2:44 am
    a = b = c = !(d = e = f = true);
    

    This will set the first ones to false, and the second ones to true. (From D onwards.)

    So in your case:

    test2 = !(test1 = test3 = true);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I've read some articles about Android NDK. Most of them claim Native C is
I've read some articles before that stated you can skip the scheme from your
I read some articles but really didn't understand what does select 1 from do?
I've read in The Pragmatic Programmer, and in some other articles (including one from
Today, I read some articles about Covariance, Contravariance (and Invariance) in Java. I read
I have read from some article that say's Apple doesn't approve the application which
I read some articles about Comet tech. All of them mentioned that the long-life
I've read some articles on the Internet that this is not possible. To communicate
So I've read some articles about scaling Socket.IO. For various reasons I don't want
I have read some articles on POCO in the enttity framework but still don't

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.