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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T01:57:20+00:00 2026-06-06T01:57:20+00:00

int result = 5; result = result–; System.out.println(result); Why is the result equal to

  • 0
int result = 5;    
result = result--;  
System.out.println(result);  

Why is the result equal to 5?

  • 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-06T01:57:21+00:00Added an answer on June 6, 2026 at 1:57 am

    This does nothing :

       result = result--;  
    

    Because result-- returns the value of result before it is decremented (contrary to --result which returns the value of result after it is decremented).
    And as the part to the right of = is executed before the =, you basically decrement result and then, on the same line, set result to the value it had before the decrement, thus canceling it in practice.

    So you could write

       result = --result;  
    

    But if you want to decrement result, simply do

    result--; 
    

    (or --result; but it’s very unusual and atypical to use it on its own, don’t do it when you don’t want to use the result of the expression but simply want to decrement)

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

Sidebar

Related Questions

Do check this code: int result = 0; result = result++; System.out.println(Result 1 =
I have a simple function: void licz() { int result = 0; for (int
I am trying to implement this bit of code: func factorial(x int) (result int)
How can I calculate year in a nullable date? partial void AgeAtDiagnosis_Compute(ref int result)
If I have a function that produces a result int and a result string
I'm having some problem with this statement declare @result int select @result = (select
How can i get result My Dream Table Result CREATE TABLE #temp( [count] int
This is the current result that can be changed from day to day (int)
int main() { int b[2][3]={{1,2},{3,4,5}}; cout << b[0][2] << endl; } And the result
try { JSONArray jArray = new JSONArray(result); for(int i=0;i<jArray.length();i++) { JSONObject json_data = jArray.getJSONObject(i);

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.