Hi,

I'm new to Java and I wanted to understand what is the difference between ++i and i++? I know at times they function the same way and at times they function differently.

1) What are those cases? Like if i say:

int i = 5;

int x = i++;

vs

int i = 5;

int x = ++i

2)What about cases when it is not just the assignment to a variable. In cases where you're using it immediately?

int i = 5;

int j = 7;

int x = i++ * --j;

or

int i = 5;

int j = 7;

int x = ++i * j++;

What is the difference?

Thanks!