Post increment problem. please help to solve it

public class test {
public static void main(String args[])
     int i=10;
     i=i++;
     System.out.println(i); // value of i is 10 why
}

Mostafa.Hashem wrote:
Absofuckinglutely NOT !
1) Save current value of x. That is, 1. This is the value of the expression "x++".
2) Increment x. x is now 2. We have now completed x++
3) Assign value from step 1 into y.i wonder how small point like this takes all that time.
Mr Jverd,
the difference between prefix increment and the postfix increment is :
IN PREFIX INCREMENT THE ASSIGNMENT OF EXPRESSION DONE FIRST THEN THE INCREMENT.
IN POSTFIX INCREMENT THE INCREMENT DONE BEFORE THE ASSIGNMENT.Wrong.
++x and x++ are both expressions. They have a value and a side effect.
In pre-increment (++x) the increment is done before the expression is evaluated. The value of the expression is the new value of x.
In post-increment (x++) the increment is done after the expression is evaluated. The value of the epxression is the original value of x.
In both cases
y = ++x;
y = x++;
The right-hand side is evaulated completely before the assignment to y is done. In fact, in ALL java assignment statements, the RHS is evaluated completely before assigning anything to the LHS.
y = ++x;
is equivalent to
x +=1;
y = x;
y = x++;
is equivalent to
tmp = x;
x += 1;
y = tmp;

Similar Messages

  • My iphone 5 32 gb has an camera autofocus problem, please help me solve this

    my iphone 5 32 gb has an camera autofocus problem, please help me solve this

    Hi teejayfs,
    Thanks for visiting Apple Support Communities.
    If you've noticed unexpected behavior with your iPhone camera, start with these steps to isolate or resolve the issue:
    Camera isn't functioning or has undesired image quality
    If the screen shows a closed lens or black image, force quit the Camera app.
    If you do not see the Camera app on the Home screen, try searching for it in Spotlight. If the camera does not show up in the search, check to make sure that Restrictions are not turned on by tappingSettings > General > Restrictions.
    Ensure the camera lens is clean and free from any obstructions. Use a microfiber polishing cloth to clean the lens.
    Cases can interfere with the camera and the flash. Try gently cleaning the lens with a clean dry cloth or removing the case if you see image or color-quality issues with photos.
    Try turning iPhone off and then back on.
    Tap to focus the camera on the subject. The image may pulse or briefly go in and out of focus as it adjusts.
    Try to remain steady while focusing:
    Still images: Remain steady while taking the picture. If you move too far in any direction, the camera automatically refocuses to the center.
    Note: If you take a picture with iPhone turned sideways, it is automatically saved in landscape orientation.
    Video: Adjust focus before you begin recording. You can also tap to readjust focus while recording. Exiting the Camera application while recording will stop recording and will save the video to the Camera Roll.
    Note: Video-recording features are not available on original iPhone or iPhone 3G.
    If your iPhone has a front and rear camera, try switching between them to verify if the issue persists on both.
    You can find these steps here:
    iPhone: Hardware troubleshooting
    http://support.apple.com/kb/TS2802
    Regards,
    Jeremy

  • 8.1.6 and designer 6i post install problem - please help

    Hello all,
    I installed designer following the install guide extremely closely. The install went off without a hitch. However, when I try to create and ERD, or any diagram, I receive this error:
    Message
    ORA-01400: cannot insert NULL into ("REPOS_OWNER"."I$SDD_DIAGRAM_SEGMENTS"."IRID")
    Message
    ORA-01400: cannot insert NULL into ("REPOS_OWNER"."I$SDD_DIAGRAM_SEGMENTS"."IRID")
    Message
    RME-02124: Failed to execute SQL statement: insert into I$SDD_DIAGRAM_SEGMENTS (DIAGRAM_REF, SEQUENCE, GRAPHICAL_DATA, PARENT_IVID, PAC_REF) values (:diag_id, :seq, :data, :diag_ivid, :diag_id)
    I'm fairly new to Oracle but I did have designer 6.0 working on 8.1.5.
    Does anyone have any suggestions?
    Thanks,
    Damon

    The same happened to me. It turns out that it had something to do with old windows registry entries that let the repository install program know that I had designer 6.0 previously installed on my system. The install apparently isn't wise enough to know that it is installing 6i. It checks the registry for the first Designer version identified and decides what repository components you need based on that. 6i uses the standard repository components (6.0 versions) and some new stuff.
    If you read your install documentation carefully (Chapter 2, Step 14, Item 2), you will note that you need to select two components to install. If the repository
    admin utility is <prior-version-aware> it neglect to even display one of those options and its easy to blow right past that screen without realizing something is amiss (that's what I did ;-P ).
    Hope this gets you going,
    As with any Oracle product install
    -- Good Luck!! --
    Sandi
    null

  • IMovie import problem - please help me solve

    hi
    this is driving me crazy
    i have a bunch of MPG clips that i need to import into imovie. i have a new macbook air running lion etc.
    surely there is an easy way of grabbing a bunch of the clips and converting them? i have been trying to work this out for weeks and no joy
    i have taken advice here before and ended up buying software only to find that lion didnt support it so i wasted a heap of $$
    thanks in advance
    cheers
    verdon

    sorted it out - just brought an app of the app store - simple in the end

  • I am not able to launch FF everytime i tr to open it, it says FF has to submit a crash report, i even tried doing that and the report was submitted too, but stiil FF did not start, and the problem still persists, please help me solve this issue in English

    Question
    I am not able to launch FF everytime i try to open it, it says FF has to submit a crash report,and restore yr tabs. I even tried doing that and the report was submitted too, but still FF did not start, and the problem still persists, please help me solve this issue
    '''(in English)'''

    Hi Danny,
    Per my understanding that you can't get the expect result by using the expression "=Count(Fields!TICKET_STATUS.Value=4) " to count the the TICKET_STATUS which value is 4, the result will returns the count of all the TICKET_STATUS values(206)
    but not 180, right?
    I have tested on my local environment and can reproduce the issue, the issue caused by you are using the count() function in the incorrect way, please modify the expression as below and have a test:
    =COUNT(IIF(Fields!TICKET_STATUS.Value=4 ,1,Nothing))
    or
    =SUM(IIF(Fields!TICKET_STATUS=4,1,0))
    If you still have any problem, please feel free to ask.
    Regards,
    Vicky Liu
    Vicky Liu
    TechNet Community Support

  • My iphone is on recovery mode and i can´t turn on it, when i try to recover it from itunes i get: "unknown error (36), i´ve tried to do lot of things but i can´t  solve my problem. please help!!

    my iphone is on recovery mode and i can´t turn on it, when i try to recover it from itunes i get: unknown error (36), i´ve tried to do lot of things but i can´t solve my problem. please help!!

    Hi, i had the same problem. Try to find the file "apple" or "itunes" don't know it anymore exactly. Ahm well you need to delet any information or just plug in your iphone into an other computer. important is that your iphone never has been pluged in this computer before. This was what i did, and it worked!

  • Hello! Why at me in new мозиле, the old kind has remained! I about the top button Firefox! As I do not establish, all turns out in an old kind! Please help to solve a problem! Thankful in advance!

    Hello! Why at me in new мозиле, the old kind has remained! I about the top button Firefox! As I do not establish, all turns out in an old kind! Please help to solve a problem! Thankful in advance!

    Hello! Why at me in new мозиле, the old kind has remained! I about the top button Firefox! As I do not establish, all turns out in an old kind! Please help to solve a problem! Thankful in advance!

  • HT1349 The nice man Joseph Shen helped me with my google problem on my iPhone and worked for 2 days and now not working again please help me solve this problem were I can retrieve my messages on the I phone when I am not at home  on my wi Fi is the only t

    The nice man Joseph Shen helped me with my google problem on my iPhone and worked for 2 days and now not working again please help me solve this problem were I can retrieve my messages on the I phone when I am not at home  on my wi Fi is the only time it works correct. Bill. [email protected]  708 752  3667 

    http://lifehacker.com/5852948/what-to-do-if-youve-forgotten-your-iphones-passcod e

  • My iphone 4 is acting like crap right i can't even restore it everytime i try to reboot it my iphone freezes at the apple logo it is ******* to the point where i just want to smash it how do i solve this problem please help?

    my iphone 4 is acting like crap right i can't even restore it everytime i try to reboot it my iphone freezes at the apple logo it is ******* me off to the point where i just want to smash it how do i solve this problem please help?

    Don't worry, just follow these steps to fix iPhone stuck on Apple logo
    => First of all Start your Computer and then connect with Internet connection, now Download the latest version of the iTunes application
    => Now install the iTunes application in your System and connect your Device with computer via Data cable
    => Now connect your Device with iTunes application and then Tab on summary option, see in the left side bar of iTunes
    => Now Select restore option from iTunes and then confirm the Restore Message for better results. After this unplug your Device and Restart it
    I hope that will surely
    Thank you...

  • My iPad stop working suddenly i see black screen only pressing the home? and sleep button dose not solve the  problem please help?

    My iPad stop working suddenly i see black screen only pressing the home and sleep button dose not solve the problem please help ?

    Frozen or unresponsive iPad
    Resolve these most common issues:
        •    Display remains black or blank
        •    Touch screen not responding
        •    Application unexpectedly closes or freezes
    http://www.apple.com/support/ipad/assistant/ipad/
    iPad Frozen, not responding, how to fix
    http://appletoolbox.com/2012/07/ipad-frozen-not-responding-how-to-fix/
    iPad Frozen? How to Force Quit an App, Reset or Restart Your iPad
    http://ipadacademy.com/2010/11/ipad-frozen-how-to-force-quit-an-app-reset-or-res tart-your-ipad
    Black or Blank Screen on iPad or iPhone
    http://appletoolbox.com/2012/10/black-or-blank-screen-on-ipad-or-iphone/
    What to Do When Your iPad Won't Turn On
    http://ipad.about.com/od/iPad_Troubleshooting/ss/What-To-Do-When-Your-Ipad-Wo-No t-Turn-On.htm
    iOS: Not responding or does not turn on
    http://support.apple.com/kb/TS3281
    Home button not working or unresponsive, fix
    http://appletoolbox.com/2013/04/home-button-not-working-or-unresponsive-fix/
    Fixing an iPad Home Button
    http://tinyurl.com/om6rd6u
    iPad: Basic troubleshooting
    http://support.apple.com/kb/TS3274
     Cheers, Tom

  • Hi .. my iPad 4 with iso 7.0.3 he is restarting himself ... How can i solve this problem please help me

    Hi .. my iPad 4 with iso 7.0.3 he is restarting himself ... How can i solve this problem please help me

    Standard troubleshooting...
    1. Try a Restart by pressing the sleep/lock button until you see the slider.  Slide to power off.  Restart by pressing the sleep/lock button until you see the Apple logo.
    2. Try a Reset by pressing the home and sleep buttons until you see the Apple logo. Takes about 5-15 secs of button holding and you won't lose any data or settings.
    3. Remove apps from Recently Used list...
    - From any Home Screen, double tap the home button to bring up the Recents List
    - Swipe up on the app preview card to remove it from the list
    - Press the home button when done.
    4. If still a problem restore with your backup.
    5. If still a problem restore as new, i.e. without your backup. See how it runs with nothing synced to it.
    6. If still a problem, it's likely a hardware issue.

  • I have iphone 3gs and it keeps shut dowm by itself every two minutes idunno if this problem related to the battery life or what? please help me solve this problem

    i have iphone 3gs and it keeps shut dowm by itself every two minutes idunno if this problem related to the battery life or what? please help me solve this problem

    See Here for Device continually restarts...
    http://support.apple.com/kb/HT1808

  • Am facing problem while buying app in appstore during payment . Getting message as" your payment is declined"- please help me solve this issue

    am facing problem while buying app in appstore during payment . Getting message as" your payment is declined"- please help me solve this issue

    If your payment method is not accepted, here is the formal Apple guidance on the situation.   iTunes Store: Changing account information

  • Hi guys i have an ipad 1 and when i plug it in to my macbook pro picasa opens up and show its name but when i open itunes i cant find the name, ive been working my head out to solve the problem please help me:(

    hi guys i have an ipad 1 and when i plug it in to my macbook pro picasa opens up and show its name but when i open itunes i cant find the name, ive been working my head out to solve the problem please help me:(

    Pay no attention to iinami, the amount of replies to people saying their handsets must have been jailbroken everytime iTunes throws out an error is tremendous. (Clearly you don't need to have any real knowledge to get to level 3 on these forums, let's hope apple's geniuses know a lot more than some of their customers.)
    http://support.apple.com/kb/TS3694
    Solution below.
    Error 9
    This error occurs when the device unexpectedly loses its USB connection with iTunes. This can occur if the device is manually disconnected during the restore process. This issue can be resolved by performing USB troubleshooting, using a different USB dock-connector cable, trying another USB port, restoring on another computer, or by eliminating conflicts from third-party security software.

  • NOKIA 5800 V50.0.005. PROBLEM PLEASE HELP.

    HI everyone,
    I updated my NOKIA  5800 from v40 to v50 through over-the-air.
    I didn't got all the features like quickoffice, cherry 2.1, Ovi music, Lifecasting, Rihanna servicelauncher.....etc
    My update package was only of 9.8 MB.Now I too can't reinstall the update through my NSU or OVI updater as the latest version of NSU is not showing any option to reinstall or repair...Please help in solving the problem . I want all the features of v50.0.005 in my NOKIA 5800.THANKS..

    If the update is not available for you, then its not. Just wait for it
    Reasons why a phone cannot update:
    1. It is a country variant - country variants often get the updates later, or have updates skipped altogether. A Turkish country variant product code for example, skipped v40 and updated from v31 straight to v50.
    2. It is network branded - phones acquired from network providers or these providers' stores SIM free are branded, and will not get updates until the networks approve and modify the updates to their liking.
    3. Special editions - These special editions are chartered editions and may never get updates unless taken to a Nokia Care center.
    If you find my post helpful please click the green star on the left under the avatar. Thanks.

Maybe you are looking for

  • Help me with my survy for my projeect

    I am doing this survy for my professor- I am at Bethedsa community college. I am already behind on this survey- so I will appreciate if you guys can quickly look at the survey file- One lucky winner will get $50 gift coupon at amazon.com We are build

  • My iMac G5 randomly falls asleep during use.

    A few weeks ago I was using my iMac and suddenly lost control of the cursor, cursor became invisible and computer went to "sleep" (ie; screen went black, "woke up" a few seconds later after moving the mouse). This problem has persisted in all sorts o

  • After opening Firefox, how do I stop every new window I open from having old tabs?

    Whenever I start Firefox, it opens a window with tabs I used from a previous session, which is what I want since I set it on Tools > Options > When Firefox starts. However, whenever I open new windows after I have opened Firefox, it always opens four

  • GetURL is triggered when animation loops

    I created a simple animation that needs to have a button on one segment of the animation. I created a button with a action of getURL in AS3, the problem I am haing is that every time the animation loops from the first frame it triggers the button and

  • Rollback in case of DB polling

    Hi All, We have a requirement to poll db, we will update a field on table for the polled records. After applying some teansformations to these records, these will be published to JMS queue. We want to maintain transaction here, so that if the JMS pub