Java

if ((j++) == k) // postfix operator

and

JavaScript

if ((++j) == k) // prefix operator

For the postfix operator the comparison is made BEFORE j is incremented.

(128.22 == 129.22)

For the prefix operator the comparison is made AFTER j is incremented.

(129.22 == 129.22)

[Update]

As Sergey mentioned, it is pretty unusual to use the ++ operator on floating point types. Floating points are a bit complicated and can be tricky to explain.

As we touched on this subject I add two links for further reading:

Look at Solution 5 for this CP question. The problem with floating numbers[^]

As a math/programming teacher, you might find this article interesting. What Every Computer Scientist Should Know About Floating-Point Arithmetic[^]

Good luck with your teaching.

`i++`

and`++i`

.Also I asked the teacher who taught it for years and he also wasn't sure... )Unbelievable!