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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T23:33:36+00:00 2026-05-29T23:33:36+00:00

This is directly inspired by this question . There are numerous references/statements that bitwise

  • 0

This is directly inspired by this question.
There are numerous references/statements that bitwise operators, when applied to booleans, will not short circuit. So in other words boolean a = f() & g(), where f() and g() both return boolean, both always will be evaluated.

However, JLS says only:

15.22.2 Boolean Logical Operators &, ^, and |
When both operands of a &, ^, or | operator are of type boolean or Boolean, then the type of
the bitwise operator expression is boolean. In all cases, the operands
are subject to unboxing conversion (§5.1.8) as necessary.

For &, the result value is true if both operand values are true;
otherwise, the result is false.

For ^, the result value is true if the operand values are different;
otherwise, the result is false.

For |, the result value is false if both operand values are false;
otherwise, the result is true.

How this warrants that both operands are actually evaluated? Apart from xor, you are still able to break and return result if one of arguments (and it may be second/right being first to be evaluated) violates condition.
Eg. a & b would need only to evaluate b to be false to evaluate the expression to false.

Please note: I’m not asking if it is implemented this way (does not short circuit) -it certainly is.

I’m asking:

Would implementing it with short circuit violate language
standard?

  • 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-29T23:33:38+00:00Added an answer on May 29, 2026 at 11:33 pm

    See JLS 15.7.2 Evaluate Operands before Operation

    The Java programming language also guarantees that every operand of an operator (except the conditional operators &&, ||, and ? 🙂 appears to be fully evaluated before any part of the operation itself is performed.

    So if you have the operator &, both operands need to be evaluated before the final result is computed.

    Additionally, the section before that one explicitly requests that the left operand of any binary operator needs to be evaluated first.

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

Sidebar

Related Questions

This question may not directly relate to programming. I have noticed that the technology
This question is directly related to my previous question ASP.NET AJAX Is it possible
I know this is not programming directly, but it's regarding a development workstation I'm
I know this question isn't directly programming related, but since I want to be
Inspired by this answer .. Can you guys point me to something similar--something that
My gut feeling is that this is not possible, but what I'd like to
This might not be possible but I am trying to create a constructor that
I've tried this example directly from MSDN: Dim Screens() As System.Windows.Forms.Screens and I can't
I know this isn't directly related to programming, but I was wondering if anyone
This selects all <B> tags directly preceded by <A> tags: A+B { /* styling

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.