Comparing primitive to wrapper object with == behaviour unexplained
<p>I have a piece of code which I need to understand:</p>

<pre><code>public static void main(String[] args) {
    Character c = new Character('a');
    Character cy = new Character('a');
    char cx = 'a';

    System.out.println(c == cx);
    System.out.println(cx == cy);
    System.out.println(c == cy);
}
</code></pre>

<p>Output:</p>

<pre><code>true
true
false
</code></pre>

<p>I am unable to understand why only the third statement is failing.</p>

<p>EDIT: This question is different to the <code>.equals</code> vs <code>==</code> question as this about primitive versus object comparison.</p>