Arithmetic operator confusion

Posted by Dusk on Stack Overflow See other posts from Stack Overflow or by Dusk
Published on 2010-01-05T09:58:05Z Indexed on 2010/04/07 1:13 UTC
Read the original article Hit count: 168

Filed under:
|
|

Why I'm getting two different values while using the arithmetic operators for the same value of variables. I've just altered little bit my second program, which is resulted in giving me the different output. Could anyone please tell me why?

    int number=113;
 int rot=0;
 rot=number%10;
 rot*=100+number/10;
 System.out.println(rot);//333



    int number=113;
 int rot=0;
 rot=number%10;
 rot=rot*100+number/10;
 System.out.println(rot);//311

© Stack Overflow or respective owner

Related posts about java

Related posts about operators