As described in the language spec:
Assignment contexts allow the use of one of the following:
- ...
- a boxing conversion (§5.1.7)
- ...
Referring to section 5.1.7:
Specifically, the following nine conversions are called the boxing conversions:
- ...
- From type char to type Character
- ...
At run time, boxing conversion proceeds as follows:
- ...
- If
p is a value of type char, then boxing conversion converts p into a reference r of class and type Character, such that r.charValue() == p
- ...
So, your line is equivalent to:
Character newCharacter = Character.valueOf('c');
Indeed, if you decompile your class, you will see that's exactly what gets invoked.
But what are the differences?
new Anything is guaranteed to create a new instance of Anything (or fail with an exception). So, new Character('c') == new Character('c') is always false.
On the other hand, Character.valueOf('c') == Character.valueOf('c') may be true, because there is no requirement for a method invocation to return a new instance. Indeed, it is guaranteed by specification that you won't get a new instance on these two invocations.
This allows you to reuse existing instances, avoiding unnecessary allocations, thus saving memory.