@khelwood's answer is correct, as far as it goes, but doesn't really tell you exactly what the pre and post increments 'are', as requested.
In the languages that have this, including Java, there are "expressions". x + y
is an expression. So are ++i
and i++
.
The expression ++i
evaluates to one more than the value i
has when the expression is evaluated. As a side effect, the value of i
is also set to that value when the expression is evaluated.
The expression i++
evaluates to the value that i has when the expression is evaluated. As a side effect, the value of i
is incremented AFTER the expression is evaluated.
There is a history to this that I find interesting; it explains to some extent why the operator exists, though I don't think it really helps understand it, so unless you're interested in the history you can just skip it.
The C language was invented and first implemented by a few engineers at Bell Labs on computers built by Digital Equipment Corporation, aka DEC. These were some of the first smaller computers, well before the Personal Computer came along. In the machine language of some of their models, they had instructions which accessed memory by adding together some internal registers. They built the machine code so that one of the registers could be incremented after the memory access, so that it was then pointed to the NEXT memory location.
In the world of small computers at that time, both execution speed and code size were precious, so being able to write a tight loop to go through memory in the fewest instructions and at machine code speed was desireable. So DEC's computers -- including their very popular PDP-11 line -- had post-and-pre increment and decrement as 'addressing modes' with which machine code could access memory.
The guys implementing C, which was and has remained a structured assembler, not a high-level language, wanted to leverage this machine-level advantage from C itself. So that's why the language has pre and post increment and decrement, now having to be implemented in every compiler that supports the language.