Could you help me a little bit? First of all, this is the code:
package helloworldapp;
public class HelloWorldApp
{
public static void main(String[] args)
{
int jaja = 1;
jaja = (jaja++)*2*2;
System.out.println(jaja);
}
}
I would like to understand this line:
jaja = (jaja++)*2*2;
As far as I know, postfix increment operator evaluates to the variable after the statement is done. Why does it give 4 as a result? Maybe I shouldn't use the same variable this way but I'm curious about that how it works. I thought that, firstly it multiply 'jaja' by 2, repeat it, the statement is over, and then add 1 to jaja. It would be 5 but I misunderstand something.
Um, it is my first comment here and also my English is really bad. Please forgive me for this :)