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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T15:50:49+00:00 2026-05-30T15:50:49+00:00

What does each expression evaluate to? Assume x is 2 before each one. int

  • 0

What does each expression evaluate to? Assume x is 2 before each one.

  • int num = x++ * 3;
    So this would be equivalent to (2)*3 or num=6 and x is now 3.

  • num *= x;
    num =2*2 or 4

  • (x < 2) && (x > 1)
    Becomes FALSE, because (2<2)=false and (2>1)=true so it’s false.

  • (++x < 2) || (x < 1)
    (3<2) is false and then ((2+1)<1) is also false, so it’s false?
    One question is in this case, is the preincrement applied to the variable before the break? Should the second x value be 3 or 2?
    I also have the same question for postincrement. Let’s say I have num=x++ *x++ where initial x=2. So is this 2*2 or 2*3?

  • 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-30T15:50:50+00:00Added an answer on May 30, 2026 at 3:50 pm

    It’s incremented before the “break” yes. Basically it’s the first thing java does (parenthesis are still the first ones actually). So in (++x < 2) || (++x < 3) the 2nd ++x happens after the first one if it isn’t true.

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

Sidebar

Related Questions

Does anyone have any ideas on if/how one could create a regular expression to
Given the following jQuery expression $(form).each(function () { var info = validationInfo(this); if (info)
And does each expression in the else if must test the same variable ?
Does each column of a table in SQL Server have a unique id? I've
Why does tempuri.org exist? Why does each XML Webservice require its own namespace, unique
How could I execute a set of .SQL files (each does some data transformations)
I've made a small program which has 2 buttons and each does certain thing.
i have a table (System.Web.UI.WebControls). each row does have three cells. in cells' controls
I have a scenario when I start 3..10 threads with ThreadPool. Each thread does
Does a java for-each loop guarantee that the elements will be presented in order

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.