In numeric or char types comparison, the values of operands are compared, whereas references comparison checks if the two references are pointing to the same object
When "==" or "!=" is used to compare a primitive to a wrapper, the wrapper will be unwrapped and the comparison will be primitive to primitive like in the first print statement.
In the second statement, a reference comparison is used, and since "x" and "z" are referencing different objects the output is "false"
Note: When comparing two wrappers of type :
1. Boolean
2. or Byte
3. or Short or Integer from -128 to 127 ,
4. or Character from \u0000 to \u007f (7f is 127 in decimal)
a value comparison not a reference comparison is used.